diff --git a/docs/api/swagger.yaml b/docs/api/swagger.yaml index 9f0e91cd7..1a5dd1fc3 100644 --- a/docs/api/swagger.yaml +++ b/docs/api/swagger.yaml @@ -296,8 +296,8 @@ definitions: type: string x-go-name: ID last_status_at: - description: When the account's most recent status was posted (ISO 8601 Datetime). - example: "2021-07-30T09:20:25+00:00" + description: When the account's most recent status was posted (ISO 8601 Date). + example: "2021-07-30" type: string x-go-name: LastStatusAt locked: @@ -2301,8 +2301,8 @@ definitions: type: string x-go-name: ID last_status_at: - description: When the account's most recent status was posted (ISO 8601 Datetime). - example: "2021-07-30T09:20:25+00:00" + description: When the account's most recent status was posted (ISO 8601 Date). + example: "2021-07-30" type: string x-go-name: LastStatusAt locked: diff --git a/internal/api/client/admin/accountsgetv2_test.go b/internal/api/client/admin/accountsgetv2_test.go index 83f394803..64c76cc1a 100644 --- a/internal/api/client/admin/accountsgetv2_test.go +++ b/internal/api/client/admin/accountsgetv2_test.go @@ -99,7 +99,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "followers_count": 1, "following_count": 1, "statuses_count": 8, - "last_status_at": "2021-07-28T08:40:37.000Z", + "last_status_at": "2021-07-28", "emojis": [], "fields": [ { @@ -157,7 +157,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -258,7 +258,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [], "fields": [], "enable_rss": true @@ -351,7 +351,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "followers_count": 0, "following_count": 0, "statuses_count": 1, - "last_status_at": "2023-11-02T10:44:25.000Z", + "last_status_at": "2023-11-02", "emojis": [], "fields": [] } @@ -396,7 +396,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } diff --git a/internal/api/client/admin/reportsget_test.go b/internal/api/client/admin/reportsget_test.go index 5213dd574..e3d0a535d 100644 --- a/internal/api/client/admin/reportsget_test.go +++ b/internal/api/client/admin/reportsget_test.go @@ -186,7 +186,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } @@ -231,7 +231,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "followers_count": 1, "following_count": 1, "statuses_count": 8, - "last_status_at": "2021-07-28T08:40:37.000Z", + "last_status_at": "2021-07-28", "emojis": [], "fields": [ { @@ -289,7 +289,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -343,7 +343,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -410,7 +410,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "followers_count": 1, "following_count": 1, "statuses_count": 8, - "last_status_at": "2021-07-28T08:40:37.000Z", + "last_status_at": "2021-07-28", "emojis": [], "fields": [ { @@ -468,7 +468,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } @@ -515,7 +515,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] }, @@ -660,7 +660,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() { "followers_count": 1, "following_count": 1, "statuses_count": 8, - "last_status_at": "2021-07-28T08:40:37.000Z", + "last_status_at": "2021-07-28", "emojis": [], "fields": [ { @@ -718,7 +718,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } @@ -765,7 +765,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] }, @@ -910,7 +910,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() { "followers_count": 1, "following_count": 1, "statuses_count": 8, - "last_status_at": "2021-07-28T08:40:37.000Z", + "last_status_at": "2021-07-28", "emojis": [], "fields": [ { @@ -968,7 +968,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } @@ -1015,7 +1015,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] }, diff --git a/internal/api/client/followrequests/get_test.go b/internal/api/client/followrequests/get_test.go index b9b6db7c6..07383a319 100644 --- a/internal/api/client/followrequests/get_test.go +++ b/internal/api/client/followrequests/get_test.go @@ -100,7 +100,7 @@ func (suite *GetTestSuite) TestGet() { "followers_count": 0, "following_count": 0, "statuses_count": 1, - "last_status_at": "2023-11-02T10:44:25.000Z", + "last_status_at": "2023-11-02", "emojis": [], "fields": [] } diff --git a/internal/api/client/instance/instancepatch_test.go b/internal/api/client/instance/instancepatch_test.go index 8b099984d..e309ff4ca 100644 --- a/internal/api/client/instance/instancepatch_test.go +++ b/internal/api/client/instance/instancepatch_test.go @@ -177,7 +177,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -317,7 +317,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -457,7 +457,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -648,7 +648,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -814,7 +814,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -991,7 +991,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, diff --git a/internal/api/client/mutes/mutesget_test.go b/internal/api/client/mutes/mutesget_test.go index 9939174a0..abe5b1135 100644 --- a/internal/api/client/mutes/mutesget_test.go +++ b/internal/api/client/mutes/mutesget_test.go @@ -148,7 +148,7 @@ func (suite *MutesTestSuite) TestIndefinitelyMutedAccountSerializesMuteExpiratio // Fetch all muted accounts for the logged-in account. // The expected body contains `"mute_expires_at":null`. - _, err = suite.getMutedAccounts(http.StatusOK, `[{"id":"01F8MH5ZK5VRH73AKHQM6Y9VNX","username":"foss_satan","acct":"foss_satan@fossbros-anonymous.io","display_name":"big gerald","locked":false,"discoverable":true,"bot":false,"created_at":"2021-09-26T10:52:36.000Z","note":"i post about like, i dunno, stuff, or whatever!!!!","url":"http://fossbros-anonymous.io/@foss_satan","avatar":"","avatar_static":"","header":"http://localhost:8080/assets/default_header.webp","header_static":"http://localhost:8080/assets/default_header.webp","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2021-09-11T09:40:37.000Z","emojis":[],"fields":[],"mute_expires_at":null}]`) + _, err = suite.getMutedAccounts(http.StatusOK, `[{"id":"01F8MH5ZK5VRH73AKHQM6Y9VNX","username":"foss_satan","acct":"foss_satan@fossbros-anonymous.io","display_name":"big gerald","locked":false,"discoverable":true,"bot":false,"created_at":"2021-09-26T10:52:36.000Z","note":"i post about like, i dunno, stuff, or whatever!!!!","url":"http://fossbros-anonymous.io/@foss_satan","avatar":"","avatar_static":"","header":"http://localhost:8080/assets/default_header.webp","header_static":"http://localhost:8080/assets/default_header.webp","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2021-09-11","emojis":[],"fields":[],"mute_expires_at":null}]`) if err != nil { suite.FailNow(err.Error()) } diff --git a/internal/api/client/reports/reportget_test.go b/internal/api/client/reports/reportget_test.go index 6b0cf89e0..a5ed14dcd 100644 --- a/internal/api/client/reports/reportget_test.go +++ b/internal/api/client/reports/reportget_test.go @@ -130,7 +130,7 @@ func (suite *ReportGetTestSuite) TestGetReport1() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } diff --git a/internal/api/client/reports/reportsget_test.go b/internal/api/client/reports/reportsget_test.go index 96fcafc22..ccede98ca 100644 --- a/internal/api/client/reports/reportsget_test.go +++ b/internal/api/client/reports/reportsget_test.go @@ -156,7 +156,7 @@ func (suite *ReportsGetTestSuite) TestGetReports() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } @@ -246,7 +246,7 @@ func (suite *ReportsGetTestSuite) TestGetReports4() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } @@ -320,7 +320,7 @@ func (suite *ReportsGetTestSuite) TestGetReports6() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } @@ -378,7 +378,7 @@ func (suite *ReportsGetTestSuite) TestGetReports7() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } diff --git a/internal/api/client/statuses/statushistory_test.go b/internal/api/client/statuses/statushistory_test.go index bcbeeba7d..983da241c 100644 --- a/internal/api/client/statuses/statushistory_test.go +++ b/internal/api/client/statuses/statushistory_test.go @@ -115,7 +115,7 @@ func (suite *StatusHistoryTestSuite) TestGetHistory() { "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [], "fields": [], "enable_rss": true diff --git a/internal/api/client/statuses/statusmute_test.go b/internal/api/client/statuses/statusmute_test.go index e506f8717..e8b6d80f2 100644 --- a/internal/api/client/statuses/statusmute_test.go +++ b/internal/api/client/statuses/statusmute_test.go @@ -133,7 +133,7 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() { "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [], "fields": [], "enable_rss": true @@ -218,7 +218,7 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() { "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [], "fields": [], "enable_rss": true diff --git a/internal/api/model/account.go b/internal/api/model/account.go index d34d7d519..3ad5d5399 100644 --- a/internal/api/model/account.go +++ b/internal/api/model/account.go @@ -84,8 +84,8 @@ type Account struct { FollowingCount int `json:"following_count"` // Number of statuses posted by this account, according to our instance. StatusesCount int `json:"statuses_count"` - // When the account's most recent status was posted (ISO 8601 Datetime). - // example: 2021-07-30T09:20:25+00:00 + // When the account's most recent status was posted (ISO 8601 Date). + // example: 2021-07-30 LastStatusAt *string `json:"last_status_at"` // Array of custom emojis used in this account's note or display name. // Empty for blocked accounts. diff --git a/internal/processing/stream/notification_test.go b/internal/processing/stream/notification_test.go index 2e83714fa..1f04d5103 100644 --- a/internal/processing/stream/notification_test.go +++ b/internal/processing/stream/notification_test.go @@ -79,7 +79,7 @@ func (suite *NotificationTestSuite) TestStreamNotification() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } diff --git a/internal/processing/stream/statusupdate_test.go b/internal/processing/stream/statusupdate_test.go index f6024686b..97e056175 100644 --- a/internal/processing/stream/statusupdate_test.go +++ b/internal/processing/stream/statusupdate_test.go @@ -90,7 +90,7 @@ func (suite *StatusUpdateTestSuite) TestStreamNotification() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] }, diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go index 6bd6d0900..3b94687dc 100644 --- a/internal/typeutils/internaltofrontend.go +++ b/internal/typeutils/internaltofrontend.go @@ -259,7 +259,7 @@ func (c *Converter) accountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A if a.Stats.LastStatusAt.IsZero() { return nil } - return util.Ptr(util.FormatISO8601(a.Stats.LastStatusAt)) + return util.Ptr(util.FormatISO8601Date(a.Stats.LastStatusAt)) }() ) diff --git a/internal/typeutils/internaltofrontend_test.go b/internal/typeutils/internaltofrontend_test.go index 139d8913a..e0671ed79 100644 --- a/internal/typeutils/internaltofrontend_test.go +++ b/internal/typeutils/internaltofrontend_test.go @@ -66,7 +66,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontend() { "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [], "fields": [], "enable_rss": true @@ -116,7 +116,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendAliasedAndMoved() "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [], "fields": [], "source": { @@ -158,7 +158,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendAliasedAndMoved() "followers_count": 1, "following_count": 1, "statuses_count": 8, - "last_status_at": "2021-07-28T08:40:37.000Z", + "last_status_at": "2021-07-28", "emojis": [], "fields": [ { @@ -211,7 +211,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendWithEmojiStruct() "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [ { "shortcode": "rainbow", @@ -258,7 +258,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendWithEmojiIDs() { "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [ { "shortcode": "rainbow", @@ -301,7 +301,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendSensitive() { "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [], "fields": [], "source": { @@ -489,7 +489,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontend() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -666,7 +666,7 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredStatusToFrontend() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -853,7 +853,7 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() { "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [], "fields": [], "enable_rss": true @@ -980,7 +980,7 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -1235,7 +1235,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendUnknownAttachments "followers_count": 0, "following_count": 0, "statuses_count": 1, - "last_status_at": "2023-11-02T10:44:25.000Z", + "last_status_at": "2023-11-02", "emojis": [], "fields": [] }, @@ -1398,7 +1398,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToWebStatus() { "followers_count": 0, "following_count": 0, "statuses_count": 1, - "last_status_at": "2023-11-02T10:44:25.000Z", + "last_status_at": "2023-11-02", "emojis": [], "fields": [] }, @@ -1530,7 +1530,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendUnknownLanguage() "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -1674,7 +1674,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendPartialInteraction "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [], "fields": [], "enable_rss": true @@ -1780,7 +1780,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToAPIStatusPendingApproval() "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -1990,7 +1990,7 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV1ToFrontend() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -2130,7 +2130,7 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV2ToFrontend() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -2250,7 +2250,7 @@ func (suite *InternalToFrontendTestSuite) TestReportToFrontend1() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } @@ -2293,7 +2293,7 @@ func (suite *InternalToFrontendTestSuite) TestReportToFrontend2() { "followers_count": 1, "following_count": 1, "statuses_count": 8, - "last_status_at": "2021-07-28T08:40:37.000Z", + "last_status_at": "2021-07-28", "emojis": [], "fields": [ { @@ -2369,7 +2369,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend1() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } @@ -2414,7 +2414,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend1() { "followers_count": 1, "following_count": 1, "statuses_count": 8, - "last_status_at": "2021-07-28T08:40:37.000Z", + "last_status_at": "2021-07-28", "emojis": [], "fields": [ { @@ -2472,7 +2472,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend1() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -2526,7 +2526,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend1() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -2603,7 +2603,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend2() { "followers_count": 1, "following_count": 1, "statuses_count": 8, - "last_status_at": "2021-07-28T08:40:37.000Z", + "last_status_at": "2021-07-28", "emojis": [], "fields": [ { @@ -2661,7 +2661,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend2() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } @@ -2708,7 +2708,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend2() { "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] }, @@ -2866,7 +2866,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontendSuspendedLoca "followers_count": 0, "following_count": 0, "statuses_count": 3, - "last_status_at": "2021-09-11T09:40:37.000Z", + "last_status_at": "2021-09-11", "emojis": [], "fields": [] } @@ -2958,7 +2958,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontendSuspendedLoca "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -3012,7 +3012,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontendSuspendedLoca "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -3158,7 +3158,7 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -3213,7 +3213,7 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() { "followers_count": 1, "following_count": 1, "statuses_count": 8, - "last_status_at": "2021-07-28T08:40:37.000Z", + "last_status_at": "2021-07-28", "emojis": [], "fields": [ { @@ -3305,7 +3305,7 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() { "followers_count": 1, "following_count": 1, "statuses_count": 4, - "last_status_at": "2021-10-20T10:41:37.000Z", + "last_status_at": "2021-10-20", "emojis": [], "fields": [], "enable_rss": true, @@ -3420,7 +3420,7 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPISelfConvo() { "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [], "fields": [], "enable_rss": true @@ -3471,7 +3471,7 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPISelfConvo() { "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [], "fields": [], "enable_rss": true @@ -3572,7 +3572,7 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPI() { "followers_count": 1, "following_count": 1, "statuses_count": 8, - "last_status_at": "2021-07-28T08:40:37.000Z", + "last_status_at": "2021-07-28", "emojis": [], "fields": [ { @@ -3634,7 +3634,7 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPI() { "followers_count": 2, "following_count": 2, "statuses_count": 8, - "last_status_at": "2024-01-10T09:24:00.000Z", + "last_status_at": "2024-01-10", "emojis": [], "fields": [], "enable_rss": true diff --git a/internal/util/time.go b/internal/util/time.go index 90e810078..0f874986a 100644 --- a/internal/util/time.go +++ b/internal/util/time.go @@ -21,6 +21,7 @@ // ISO8601 is a formatter for serializing times that forces ISO8601 behavior. const ISO8601 = "2006-01-02T15:04:05.000Z" +const ISO8601Date = "2006-01-02" // FormatISO8601 converts the given time to UTC and then formats it // using the ISO8601 const, which the Mastodon API is able to understand. @@ -28,6 +29,12 @@ func FormatISO8601(t time.Time) string { return t.UTC().Format(ISO8601) } +// Mastodon returns UTC dates (without time) for last_status_at/LastStatusAt as +// a special case, but most of the time you want to use FormatISO8601 instead. +func FormatISO8601Date(t time.Time) string { + return t.UTC().Format(ISO8601Date) +} + // ParseISO8601 parses the given time string according to the ISO8601 const. func ParseISO8601(in string) (time.Time, error) { return time.Parse(ISO8601, in)