Skip to content
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: MST parsing issues #39588

Closed
pjebs opened this issue Jun 15, 2020 · 1 comment
Closed

time: MST parsing issues #39588

pjebs opened this issue Jun 15, 2020 · 1 comment

Comments

@pjebs
Copy link
Contributor

pjebs commented Jun 15, 2020

Go 1.14

localTime := time.Now().Local().Format("2006-01-02T15:04:05Z07:00MST")
// localTime = "2020-06-15T13:47:58+10:00Australian Eastern Standard Time"

time.Parse("2006-01-02T15:04:05Z07:00MST", localTime)
// error = parsing time "2020-06-15T13:44:58+10:00Australian Eastern Standard Time" as "2006-01-02T15:04:05Z07:00MST": cannot parse "Australian Eastern Standard Time" as "MST"

https://play.golang.org/p/dfC-Z1frms5

Should the operation above be the inverse and hence return the original value back instead of producing an error?

@ianlancetaylor
Copy link
Contributor

Perhaps it should be an inverse, but unfortunately it isn't, and it never has been. When printing, MST can print the full name of a time zone, as it does here. When parsing, MST can only match a three to five letter code such as AEST.

Closing because this is expected behavior.

@golang golang locked and limited conversation to collaborators Jun 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants