-
Notifications
You must be signed in to change notification settings - Fork 18k
time: time zone parsing when format includes time zone seconds fails #68263
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
Comments
Change https://go.dev/cl/595897 mentions this issue: |
HI @darinkrauss , have you looked at #56528 (comment) ? Seems related to me. Thanks. |
Hi @thanm! I had not seen that comment. After reviewing, though, I'm not sure I see how it is related. This issue is related to parsing the ISO-8601 "Z" abbreviation for UTC when using the "Z070000" and "Z07:00:00" time formats. Parsing currently works for the other "Z"-related time formats (without seconds) such as "Z0700" and "Z07:00". What am I missing? |
The current implementation fails to parse a time string with a "Z" time zone using a time format that includes time zone seconds. This fix correctly parses the "Z" time zone for any Z-base time format that includes seconds (i.e. "Z070000" or "Z07:00:00"). Fixes golang#68263 Change-Id: Idf8fa06b5f96383f050c4ffbd2bc5804fd408650 Reviewed-on: https://go-review.googlesource.com/c/go/+/595897 Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
Go version
go version go1.22.4 darwin/amd64
Output of
go env
in your module/workspace:What did you do?
Parsing a time string with a "Z" time zone using a time format that includes time zone seconds fails.
https://go.dev/play/p/FgeEzRinnL8
What did you see happen?
The call to
time.Parse
returned an error. For example, this code:outputs:
What did you expect to see?
The call to
time.Parse
to succeed and return a time with the UTC time zone location. For example, this code:SHOULD output:
The text was updated successfully, but these errors were encountered: