-
Notifications
You must be signed in to change notification settings - Fork 541
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
Minimum year changed in 0.4.32 #1382
Comments
Would you be able to bisect? I think it might be #1317 but would be good to be sure. |
You're right, this is the commit that introduced the issue: b72752f |
Judging from the commit and the fact that it changes the comments too, this is the intended change by this commit, not an error. |
Honestly I'm not really sure this is obviously true? The API didn't change. The value did change somewhat, but I doubt there's a lot of code that is affected by the exact value of the minimum. I don't think I want to revert this based on a single report, but if it turns out to affect a bunch of other people I might reconsider. |
NaiveDate::from_ymd_opt
in 0.4.32
The API didn't change, but the behavior did. For example, if someone stored serialized
Ignore the above question, it's probably because year 0 doesn't exist, right? So passing 0 means year -1 BCE? |
That's true -- and does make the case stronger for this being to big of a deal. Are you aware of actual applications or libraries that store Maybe it would be viable to special case this in deserialization code, to silently change -262_144 to -262_143?
Not exactly sure what you're asking here. Year 0 is a well-defined value, but this change is about slightly shrinking the range of negative years, with the minimum supported year changing from -262_144 to -262_143. |
The reason to change
Depending on the value of an arbitrary defined constant from another crate is tricky. The year -262144 was clearly pretty implementation-specific. Like @djc I am curious, is this an actual problem or mostly theoretical and uncovered by a failing test? |
I'm not aware of any actual applications having this problem, so I guess we can just fix this on our end.
I assumed that if I pass |
As another thought: if your code was allowing values close to |
Chrono uses the Proleptic Gregorian calendar. The year 1 BCE is the year 0 in the Proleptic Gregorian calendar. And individual dates before the switch from the Julian to Gregorian calendar (which differs per country) is a bit of a mess 😄. |
I think that would be a decent solution for now. Perhaps it would be better to avoid having your tests depend on the exact value of Again, if we see more widespread reports of this breaking things, I'm open to reverting this change but as it stands I don't think your test case by itself is rationale enough to forego the benefit of avoiding potentially tricky panic behavior. |
That comment must have slipped through. Would you be willing to make a PR? |
Ok, that makes sense, thanks for explanation.
That's the plan, I'll change our test. I guess this can be closed.
Is the comment incorrect? From your comment about Proleptic Gregorian Calendar I assumed it was fine (because passing |
@Lorak-mmk it sounds like you had a use case explicitly dependent on |
@jtmoon79 the code from the OP suggests that this was a test case in their library. |
The following code works with chrono 0.4.31, but fails with 0.4.32:
The failure is because
from_ymd_opt
returns None.The text was updated successfully, but these errors were encountered: