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
proposal: Go 2: time: change the Time behavior #30086
Comments
These changes will presumably break some working code in ways that are very hard to detect, which carries a cost. The second suggestion in particular seems completely arbitrary to me. What is the benefit of making these changes? |
The benefit would be to get a consistent modification of data set by the user, to avoid unexpected results at working with data related to dates. |
I have no intuition that "2010-01-00" should be "2010-01-01". In fact to me it seems intuitive that "2010-01-00" is "the before 2010-01-01", and so "2009-12-31" seems correct. |
The issue is that it changes three data. Instead of be handled with "before of", it could be handled thinking in both minimum and maximum values for a field:
|
I think that suggested change would be strictly worse than the current behavior, because it would make it much harder to write code like |
In my opinion the current |
The current behavior is documented and works and is not clearly wrong. Changing it will break existing programs for a very small benefit. We are not going to do this. |
time.Time{}
is set to "0001-01-01". So, to get a better consistence, it should get the same zero value ("0001-01-01").https://play.golang.org/p/Dk9uYACNgZm
https://play.golang.org/p/NYVZhLzzicL
The text was updated successfully, but these errors were encountered: