accounts/keystore: include minutes in toISO8601 timezone offset

The timezone suffix only encoded hours, producing incorrect filenames
in zones with non-zero minute offsets (e.g. UTC+05:30 → "+0530" not
"+00500"). Format both hours and minutes separately.
This commit is contained in:
Weixie Cui 2026-07-04 20:52:34 +08:00
parent e3b6d0c86f
commit faf48da321

View file

@ -230,7 +230,12 @@ func toISO8601(t time.Time) string {
if name == "UTC" {
tz = "Z"
} else {
tz = fmt.Sprintf("%+03d00", offset/3600)
hours := offset / 3600
minutes := (offset % 3600) / 60
if minutes < 0 {
minutes = -minutes
}
tz = fmt.Sprintf("%+03d%02d", hours, minutes)
}
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)