[bugfix] Account.last_status_at is a date, not datetime (#3419)

* [bugfix] Account.last_status_at is a date, not datetime

Fix #3418

* update swagger
This commit is contained in:
Markus Unterwaditzer 2024-10-12 10:02:26 +02:00 committed by GitHub
commit 95a316236e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 86 additions and 79 deletions

View file

@ -21,6 +21,7 @@ import "time"
// 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)