update timestamp format
diff --git a/api.go b/api.go index 972b8eb..8a628e7 100644 --- a/api.go +++ b/api.go
@@ -32,8 +32,9 @@ ) const ( - sqlTimeFormat = "2006-01-02 15:04:05.999 -0700 MST" - iso8601 = "2006-01-02T15:04:05.999Z07:00" + sqlTimeFormat = "2006-01-02 15:04:05.999 -0700 MST" + iso8601 = "2006-01-02T15:04:05.999Z07:00" + sqliteTimeFormat = "2006-01-02 15:04:05.999-07:00" ) type deploymentsResult struct { @@ -392,7 +393,7 @@ if t == "" { return "" } - formats := []string{sqlTimeFormat, iso8601, time.RFC3339} + formats := []string{sqliteTimeFormat, sqlTimeFormat, iso8601, time.RFC3339} for _, f := range formats { timestamp, err := time.Parse(f, t) if err == nil {
diff --git a/api_test.go b/api_test.go index eee3fdd..a49b9a5 100644 --- a/api_test.go +++ b/api_test.go
@@ -364,8 +364,8 @@ }) It("should get iso8601 time", func() { - testTimes := []string{"", "2017-04-05 04:47:36.462 +0000 UTC", "2017-04-05 04:47:36.462 -0700 MST", "2017-04-05T04:47:36.462Z", "2017-04-05T04:47:36.462-07:00"} - isoTime := []string{"", "2017-04-05T04:47:36.462Z", "2017-04-05T04:47:36.462-07:00", "2017-04-05T04:47:36.462Z", "2017-04-05T04:47:36.462-07:00"} + testTimes := []string{"", "2017-04-05 04:47:36.462 +0000 UTC", "2017-04-05 04:47:36.462-07:00", "2017-04-05T04:47:36.462Z", "2017-04-05 23:23:38.162+00:00"} + isoTime := []string{"", "2017-04-05T04:47:36.462Z", "2017-04-05T04:47:36.462-07:00", "2017-04-05T04:47:36.462Z", "2017-04-05T23:23:38.162Z"} for i, t := range testTimes { log.Debug("insert deployment with timestamp: " + t) deploymentID := "api_time_iso8601_" + strconv.Itoa(i)