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
The given example prints: Expected: Europe/Helsinki, Got:
What did you expect to see?
The given example prints: Expected: Europe/Helsinki, Got: Europe/Helsinki
The text was updated successfully, but these errors were encountered:
seankhliao
changed the title
time.ParseInLocation may return time with a location that yields an empty string
time: ParseInLocation may return time with a location that yields an empty string
Jan 20, 2025
I believe that's correct, it's an unnamed location with a fixed time offset of 2 hours (7200 secs).
It doesn't match Europe/Helsinki because at that time, Helsinki observes DST with an offset of +0300.
Ah that makes sense; indeed when adjusting the parsed time to match the expected offset, it keeps the location info.
So I guess the solution to ensure the location would be to use t = t.In(location) afterwards to keep consistency.
Thanks for clarifying and sorry for the apparently unnecessary noise.
Go version
1.23
Output of
go env
in your module/workspace:What did you do?
I parse a time string using a known location name.
The resulting time ends up with the location name being empty, though.
https://go.dev/play/p/WVdVLmBjkuL
What did you see happen?
The given example prints:
Expected: Europe/Helsinki, Got:
What did you expect to see?
The given example prints:
Expected: Europe/Helsinki, Got: Europe/Helsinki
The text was updated successfully, but these errors were encountered: