mirror of https://github.com/spf13/cast.git
Fix date parse for "2016-03-06 15:28:01 +0900"
This commit is contained in:
parent
3f42935ca9
commit
88075729b0
|
@ -1211,6 +1211,8 @@ func TestToTime(t *testing.T) {
|
||||||
{"2016-03-06 15:28:01", time.Date(2016, 3, 6, 15, 28, 1, 0, time.UTC), false},
|
{"2016-03-06 15:28:01", time.Date(2016, 3, 6, 15, 28, 1, 0, time.UTC), false},
|
||||||
{"2016-03-06 15:28:01 -0000", time.Date(2016, 3, 6, 15, 28, 1, 0, time.UTC), false},
|
{"2016-03-06 15:28:01 -0000", time.Date(2016, 3, 6, 15, 28, 1, 0, time.UTC), false},
|
||||||
{"2016-03-06 15:28:01 -00:00", time.Date(2016, 3, 6, 15, 28, 1, 0, time.UTC), false},
|
{"2016-03-06 15:28:01 -00:00", time.Date(2016, 3, 6, 15, 28, 1, 0, time.UTC), false},
|
||||||
|
{"2016-03-06 15:28:01 +0900", time.Date(2016, 3, 6, 6, 28, 1, 0, time.UTC), false},
|
||||||
|
{"2016-03-06 15:28:01 +09:00", time.Date(2016, 3, 6, 6, 28, 1, 0, time.UTC), false},
|
||||||
{"2006-01-02", time.Date(2006, 1, 2, 0, 0, 0, 0, time.UTC), false},
|
{"2006-01-02", time.Date(2006, 1, 2, 0, 0, 0, 0, time.UTC), false},
|
||||||
{"02 Jan 2006", time.Date(2006, 1, 2, 0, 0, 0, 0, time.UTC), false},
|
{"02 Jan 2006", time.Date(2006, 1, 2, 0, 0, 0, 0, time.UTC), false},
|
||||||
{1472574600, time.Date(2016, 8, 30, 16, 30, 0, 0, time.UTC), false},
|
{1472574600, time.Date(2016, 8, 30, 16, 30, 0, 0, time.UTC), false},
|
||||||
|
|
4
caste.go
4
caste.go
|
@ -1296,8 +1296,8 @@ var (
|
||||||
timeFormat{"2006-01-02 15:04:05Z07:00", timeFormatNumericTimezone},
|
timeFormat{"2006-01-02 15:04:05Z07:00", timeFormatNumericTimezone},
|
||||||
timeFormat{"2006-01-02", timeFormatNoTimezone},
|
timeFormat{"2006-01-02", timeFormatNoTimezone},
|
||||||
timeFormat{"02 Jan 2006", timeFormatNoTimezone},
|
timeFormat{"02 Jan 2006", timeFormatNoTimezone},
|
||||||
timeFormat{"2006-01-02 15:04:05 -07:00", 1},
|
timeFormat{"2006-01-02 15:04:05 -07:00", timeFormatNumericTimezone},
|
||||||
timeFormat{"2006-01-02 15:04:05 -0700", 1},
|
timeFormat{"2006-01-02 15:04:05 -0700", timeFormatNumericTimezone},
|
||||||
timeFormat{time.Kitchen, timeFormatTimeOnly},
|
timeFormat{time.Kitchen, timeFormatTimeOnly},
|
||||||
timeFormat{time.Stamp, timeFormatTimeOnly},
|
timeFormat{time.Stamp, timeFormatTimeOnly},
|
||||||
timeFormat{time.StampMilli, timeFormatTimeOnly},
|
timeFormat{time.StampMilli, timeFormatTimeOnly},
|
||||||
|
|
Loading…
Reference in New Issue