From 36dfef3c74fb2290710c69f8afea2becf0d6c338 Mon Sep 17 00:00:00 2001 From: Aaron Raddon Date: Tue, 6 May 2014 12:34:24 -0700 Subject: [PATCH] fix 24 hour range on date parse --- parseany.go | 2 +- parseany_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/parseany.go b/parseany.go index 4cb5844..22452a5 100644 --- a/parseany.go +++ b/parseany.go @@ -182,7 +182,7 @@ func ParseAny(datestr string) (time.Time, error) { //2006-01-02 //2006-01-02 if len(datestr) == len("2014-04-26 05:24:37.3186369") { - if t, err := time.Parse("2006-01-02 03:04:05.0000000", datestr); err == nil { + if t, err := time.Parse("2006-01-02 15:04:05.0000000", datestr); err == nil { return t, nil } else { u.Error(err) diff --git a/parseany_test.go b/parseany_test.go index a62193a..38881b3 100644 --- a/parseany_test.go +++ b/parseany_test.go @@ -92,9 +92,9 @@ func TestParse(t *testing.T) { assert.T(t, "2009-08-13 05:15:09 +0000 UTC" == fmt.Sprintf("%v", ts2.In(time.UTC))) //2014-04-26 05:24:37.3186369 - ts, err = ParseAny("2014-04-26 05:24:37.3186369") + ts, err = ParseAny("2014-04-26 17:24:37.3186369") assert.T(t, err == nil) u.Debug(ts.Unix(), ts) - assert.T(t, "2014-04-26 05:24:37.3186369 +0000 UTC" == fmt.Sprintf("%v", ts.In(time.UTC))) + assert.T(t, "2014-04-26 17:24:37.3186369 +0000 UTC" == fmt.Sprintf("%v", ts.In(time.UTC))) }