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: date fields have not the same value at parsing a time layout #29902
Comments
0000-01-01 is a valid date: January 1 0000, while 0000-00-00 is not (neither zero month, nor zero day are in calendar). |
But I'm not expecting a valid value for the date since the value to be used is going to be the time; I was expecting that only the data to be used (the time at this case) was set. |
|
This is working as expected and as documented (#29902 (comment)). |
But since the zero value (at date) of time.Time{} is set to "0001-01-01", then I think that such value also should be used instead of (0000-01-01). |
I don't necessarily disagree, but since this behavior is documented it falls under the Go 1 Compatibility Promise and can't be changed.
|
Added a proposal for Go 2: #30086 |
When it is parsed a time, then the date fields are not set with the same value.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
https://play.golang.org/p/ZQvuNS98GZh
What did you expect to see?
I expected that the the fields of the date were all to zero (0000-00-00) or at least all with the same value (0001-01-01)
What did you see instead?
The date is set to: 0000-01-01
The text was updated successfully, but these errors were encountered: