From ee5353cf832a2fec57eacb77396a443e6d6a5b9e Mon Sep 17 00:00:00 2001 From: DmitriyMV Date: Thu, 2 Mar 2017 14:11:09 +0300 Subject: This commit removes all usages of github.com/jinzhu/now. github.com/jinzhu/now has numerous errors handling date and time. The example's of them are: 1. Incorrect handling of DST (https://github.com/jinzhu/now/issues/13). 2. 24 Hour long days (https://stackoverflow.com/questions/25254443/return-local-beginning-of-day-time-object-in-go) Chicago has 23, 24, or 25 hours in a day. 3. Incorrect usage of time.Truncate which can return time with a non-zero minute, depending on the time's Location. (https://github.com/golang/go/issues/16647). There are other issues as well, including getting incorrect beginning and end of the month. --- vendor/github.com/jinzhu/now/main.go | 103 ----------------------------------- 1 file changed, 103 deletions(-) delete mode 100644 vendor/github.com/jinzhu/now/main.go (limited to 'vendor/github.com/jinzhu/now/main.go') diff --git a/vendor/github.com/jinzhu/now/main.go b/vendor/github.com/jinzhu/now/main.go deleted file mode 100644 index 5210ba2..0000000 --- a/vendor/github.com/jinzhu/now/main.go +++ /dev/null @@ -1,103 +0,0 @@ -// Package now is a time toolkit for golang. -// -// More details README here: https://github.com/jinzhu/now -// -// import "github.com/jinzhu/now" -// -// now.BeginningOfMinute() // 2013-11-18 17:51:00 Mon -// now.BeginningOfDay() // 2013-11-18 00:00:00 Mon -// now.EndOfDay() // 2013-11-18 23:59:59.999999999 Mon -package now - -import "time" - -var FirstDayMonday bool -var TimeFormats = []string{"1/2/2006", "1/2/2006 15:4:5", "2006-1-2 15:4:5", "2006-1-2 15:4", "2006-1-2", "1-2", "15:4:5", "15:4", "15", "15:4:5 Jan 2, 2006 MST"} - -type Now struct { - time.Time -} - -func New(t time.Time) *Now { - return &Now{t} -} - -func BeginningOfMinute() time.Time { - return New(time.Now()).BeginningOfMinute() -} - -func BeginningOfHour() time.Time { - return New(time.Now()).BeginningOfHour() -} - -func BeginningOfDay() time.Time { - return New(time.Now()).BeginningOfDay() -} - -func BeginningOfWeek() time.Time { - return New(time.Now()).BeginningOfWeek() -} - -func BeginningOfMonth() time.Time { - return New(time.Now()).BeginningOfMonth() -} - -func BeginningOfQuarter() time.Time { - return New(time.Now()).BeginningOfQuarter() -} - -func BeginningOfYear() time.Time { - return New(time.Now()).BeginningOfYear() -} - -func EndOfMinute() time.Time { - return New(time.Now()).EndOfMinute() -} - -func EndOfHour() time.Time { - return New(time.Now()).EndOfHour() -} - -func EndOfDay() time.Time { - return New(time.Now()).EndOfDay() -} - -func EndOfWeek() time.Time { - return New(time.Now()).EndOfWeek() -} - -func EndOfMonth() time.Time { - return New(time.Now()).EndOfMonth() -} - -func EndOfQuarter() time.Time { - return New(time.Now()).EndOfQuarter() -} - -func EndOfYear() time.Time { - return New(time.Now()).EndOfYear() -} - -func Monday() time.Time { - return New(time.Now()).Monday() -} - -func Sunday() time.Time { - return New(time.Now()).Sunday() -} - -func EndOfSunday() time.Time { - return New(time.Now()).EndOfSunday() -} - -func Parse(strs ...string) (time.Time, error) { - return New(time.Now()).Parse(strs...) -} - -func MustParse(strs ...string) time.Time { - return New(time.Now()).MustParse(strs...) -} - -func Between(time1, time2 string) bool { - return New(time.Now()).Between(time1, time2) -} -- cgit v1.3