diff --git a/flagengine/utils/time.go b/flagengine/utils/time.go index 767dc27..2df0920 100644 --- a/flagengine/utils/time.go +++ b/flagengine/utils/time.go @@ -3,19 +3,19 @@ package utils import ( "strings" "time" -) -const iso8601 = "2006-01-02T15:04:05.999999" + "github.com/nav-inc/datetime" +) type ISOTime struct { time.Time } func (i *ISOTime) UnmarshalJSON(bytes []byte) (err error) { - i.Time, err = time.Parse(iso8601, strings.Trim(string(bytes), `"`)) + i.Time, err = datetime.Parse(strings.Trim(string(bytes), `"`), time.UTC) return } func (i *ISOTime) MarshalJSON() ([]byte, error) { - return []byte(`"` + i.Time.Format(iso8601) + `"`), nil + return []byte(`"` + i.Time.Format(time.RFC3339) + `"`), nil }