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

Comments

Projects
None yet
3 participants
@stakhiv
Copy link

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

This comment has been minimized.

Copy link
Member

commented Feb 3, 2017

@bradfitz bradfitz closed this 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.
You can’t perform that action at this time.