fix unsupported timestamp format
diff --git a/api.go b/api.go index 98a7c01..e3406ab 100644 --- a/api.go +++ b/api.go
@@ -49,6 +49,7 @@ 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" + changeTimeFormat = "2006-01-02 15:04:05.999" ) type deploymentsResult struct { @@ -407,7 +408,7 @@ if t == "" { return "" } - formats := []string{sqliteTimeFormat, sqlTimeFormat, iso8601, time.RFC3339} + formats := []string{sqliteTimeFormat, sqlTimeFormat, iso8601, time.RFC3339, changeTimeFormat} for _, f := range formats { timestamp, err := time.Parse(f, t) if err == nil {
diff --git a/api_test.go b/api_test.go index fb86a65..c725129 100644 --- a/api_test.go +++ b/api_test.go
@@ -378,8 +378,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-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"} + 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", "2017-06-22 16:41:02.334"} + 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", "2017-06-22T16:41:02.334Z"} for i, t := range testTimes { log.Debug("insert deployment with timestamp: " + t) deploymentID := "api_time_iso8601_" + strconv.Itoa(i)