accounts/keystore: fix negative timezone sign in toISO8601 (#35245)

This commit is contained in:
cui 2026-07-01 10:33:45 +08:00 committed by GitHub
parent 5c253e557e
commit b6e2f13a9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -230,7 +230,7 @@ func toISO8601(t time.Time) string {
if name == "UTC" { if name == "UTC" {
tz = "Z" tz = "Z"
} else { } else {
tz = fmt.Sprintf("%03d00", offset/3600) tz = fmt.Sprintf("%+03d00", offset/3600)
} }
return fmt.Sprintf("%04d-%02d-%02dT%02d-%02d-%02d.%09d%s", return fmt.Sprintf("%04d-%02d-%02dT%02d-%02d-%02d.%09d%s",
t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), tz) t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), tz)