mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 02:22:26 -05:00
[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:
parent
77d755e330
commit
95a316236e
16 changed files with 86 additions and 79 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue