You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each Location can have multiple timezones so that would have to be Zones (not Zone), returning a slice of zonenames. Same for offsets. For example Europe/Rome has [CET, CEST].
Keep also in mind that the set of timezones used in a Location can change over time, so I'm not so sure it would make sense to add a Zones method to Location.
The zone name and zone offset in use depend on exactly what time it is. That's why time.Time has the method and not time.Location. We could add a method on Location where you pass in a time, but then instead of loc.ZoneFor(t) why not do t.In(loc).Zone()?
(This is also why Location is called Location and not time.Zone.)
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.8
What operating system and processor architecture are you using (
go env
)?mac OS
What did you do?
I found method
Zone()
ontime.Time
that get the zone name and zone offset second.I want get the same things from
time.Location
.Do you consider add a
Zone()
method totime.Location
?It's also really better that we can get a method
Offset(*time.Location)
intime.Location
Thanks for your reply.
The text was updated successfully, but these errors were encountered: