diff options
| author | Grant Ammons <gammons@gmail.com> | 2016-09-07 09:09:07 -0400 |
|---|---|---|
| committer | Grant Ammons <gammons@gmail.com> | 2016-09-07 09:09:07 -0400 |
| commit | b152f2ef04a04af5185891428a63e5343187b1f8 (patch) | |
| tree | ebce2111110a9f1adf3abe450d68922cd276c199 /vendor/github.com/jinzhu/now/main.go | |
| parent | a98742ce47c0d3a4b21e6733666e1edec9118eab (diff) | |
Add vendor
Diffstat (limited to 'vendor/github.com/jinzhu/now/main.go')
| -rw-r--r-- | vendor/github.com/jinzhu/now/main.go | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/vendor/github.com/jinzhu/now/main.go b/vendor/github.com/jinzhu/now/main.go new file mode 100644 index 0000000..5210ba2 --- /dev/null +++ b/vendor/github.com/jinzhu/now/main.go @@ -0,0 +1,103 @@ +// 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) +} |
