chronotope / chrono

Date and time library for Rust
Other
3.28k stars 516 forks source link

Breaking change in chrono 0.4.32 (Accepted MAX date changed) #1389

Closed weiznich closed 6 months ago

weiznich commented 7 months ago

We have failing tests in diesel due to a breaking change in a chrono 0.4.32

I was able to minize it to the following code:

use chrono::NaiveDate;

fn main() {
    let max = NaiveDate::MAX;
    dbg!(max);

    let d = NaiveDate::from_ymd_opt(262143, 12, 31);
    assert!(d.is_some());
}

This code compiles and runs without panic using chrono < 0.4.32 and triggers the assert with 0.4.32 and 0.4.33. Interestingly NaiveDate::MAX is equal to the provided date, as shown by the dbg! call before, so it's not clear what's now the actual supported maximum date.

This is similar to https://github.com/chronotope/chrono/issues/1382 but about a change in the supported max date instead.

djc commented 7 months ago

So this is likely from #1317, but it looks like we may have made things internally inconsistent. @pitdicker are you able to look into this one?

pitdicker commented 7 months ago

Yes, this is https://github.com/chronotope/chrono/pull/1317.

@djc I'd like edit the release notes to put the changes into sections like changed, fixed etc, and call out these changes to the accepted range of NaiveDate and Duration. I'm not sure how to best do so and make it reviewable. Shall I give it a shot and you can then edit again if needed?

djc commented 7 months ago

@djc I'd like edit the release notes to put the changes into sections like changed, fixed etc, and call out these changes to the accepted range of NaiveDate and Duration. I'm not sure how to best do so and make it reviewable. Shall I give it a shot and you can then edit again if needed?

Sounds good!

pitdicker commented 7 months ago

Updated the release notes https://github.com/chronotope/chrono/releases/tag/v0.4.32.