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 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

@ianlancetaylor ianlancetaylor commented Jun 15, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.