summaryrefslogtreecommitdiff
path: root/internal/util
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-06-04 20:03:01 +0200
committerLibravatar GitHub <noreply@github.com>2022-06-04 20:03:01 +0200
commitf3b44426f4bdc18ef14f68bb8381646fdc2ef241 (patch)
tree22b4b693181c91ef18eb590b9b49d5ed45eca675 /internal/util
parent[feature] Start adding advanced configuration options, starting with `samesit... (diff)
downloadgotosocial-f3b44426f4bdc18ef14f68bb8381646fdc2ef241.tar.xz
[bugfix] Update time marshalling format to provide 3 digits of ms (#630)
Diffstat (limited to 'internal/util')
-rw-r--r--internal/util/time.go2
-rw-r--r--internal/util/time_test.go6
2 files changed, 4 insertions, 4 deletions
diff --git a/internal/util/time.go b/internal/util/time.go
index ec24853fb..f969908a7 100644
--- a/internal/util/time.go
+++ b/internal/util/time.go
@@ -21,7 +21,7 @@ package util
import "time"
// ISO8601 is a formatter for serializing times that forces ISO8601 behavior.
-const ISO8601 = "2006-01-02T15:04:05.00Z"
+const ISO8601 = "2006-01-02T15:04:05.000Z"
// FormatISO8601 converts the given time to UTC and then formats it
// using the ISO8601 const, which the Mastodon API is able to understand.
diff --git a/internal/util/time_test.go b/internal/util/time_test.go
index 5343c21a4..5f75b09bc 100644
--- a/internal/util/time_test.go
+++ b/internal/util/time_test.go
@@ -33,19 +33,19 @@ type TimeSuite struct {
func (suite *TimeSuite) TestISO8601Format1() {
testTime := testrig.TimeMustParse("2022-05-17T13:10:59Z")
testTimeString := util.FormatISO8601(testTime)
- suite.Equal("2022-05-17T13:10:59.00Z", testTimeString)
+ suite.Equal("2022-05-17T13:10:59.000Z", testTimeString)
}
func (suite *TimeSuite) TestISO8601Format2() {
testTime := testrig.TimeMustParse("2022-05-09T07:34:35+02:00")
testTimeString := util.FormatISO8601(testTime)
- suite.Equal("2022-05-09T05:34:35.00Z", testTimeString)
+ suite.Equal("2022-05-09T05:34:35.000Z", testTimeString)
}
func (suite *TimeSuite) TestISO8601Format3() {
testTime := testrig.TimeMustParse("2021-10-04T10:52:36+02:00")
testTimeString := util.FormatISO8601(testTime)
- suite.Equal("2021-10-04T08:52:36.00Z", testTimeString)
+ suite.Equal("2021-10-04T08:52:36.000Z", testTimeString)
}
func TestTimeSuite(t *testing.T) {