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: time.Parse day range inconsistency. #18921

Closed
stakhiv opened this issue Feb 3, 2017 · 1 comment
Closed

time: time.Parse day range inconsistency. #18921

stakhiv opened this issue Feb 3, 2017 · 1 comment

Comments

@stakhiv
Copy link

stakhiv commented Feb 3, 2017

What version of Go are you using (go version)?

go version go1.7.5 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOOS="darwin"

What did you do?

Parsing of "February 99" returns an error - https://play.golang.org/p/A2vCJo_oS9
But there's no error on parsing "February 00" - https://play.golang.org/p/AbcCMQ4xIo

https://golang.org/pkg/time/#Parse documentation seems to be outdated too.

No checking is done that the day of the month is within the month's valid dates; any one- or two-digit value is accepted. For example February 31 and even February 99 are valid dates, specifying dates in March and May. This behavior is consistent with time.Date.

What did you expect to see?

https://play.golang.org/p/AbcCMQ4xIo should return "day out of range" error for "February 00".

What did you see instead?

No error and previous day instead 0000-01-31 00:00:00 +0000 UTC

@bradfitz
Copy link
Contributor

bradfitz commented Feb 3, 2017

Fixed in Go 1.8: https://beta.golang.org/doc/go1.8#time

@bradfitz bradfitz closed this as completed Feb 3, 2017
@golang golang locked and limited conversation to collaborators Feb 3, 2018
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