-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
time: time.LoadLocation returns incorrect time zone #34101
Comments
Thanks for reporting this. You are on 1.11, but I can reproduce the issue on go1.12 and on tip too, so it's not a recent regression. It appears to be an issue in the parsing function. For example, the following:
prints:
note how the timezone info is completely wrong. But if I add the year to the time format, like this:
Then it works fine:
|
I was wrong, this is working as intended. Without a year, the default is the year 0000 and we can't really print meaningful timezone/zone offset info for that year. So Basically we print what the tzdata database has a the first recorded timezone and offset. This is a dup of #10297. Closing, as this is not a bug. |
Without a year would it be reasonable to assume current year, same perspective as kitchen time? Being that omission = current rather than 0 |
@dhalman This issue has been closed for months. I don't think we should change the behavior of |
Agreed! Just academically curious if there is ever an expected use case where the developer would plausibly want the current expected default behavior over the configured behavior. No worries! Thanks for even responding :) |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Location : Europe/Amsterdam Time : 0000-01-01 13:40:00 +0100 CET
Location : Europe/Berlin Time : 0000-01-01 13:40:00 +0100 CET
What did you see instead?
Location : Europe/Amsterdam Time : 0000-01-01 13:40:00 +0019 AMT
Location : Europe/Berlin Time : 0000-01-01 13:40:00 +0100 CET
The text was updated successfully, but these errors were encountered: