chronotope / chrono

Date and time library for Rust
Other
3.3k stars 523 forks source link

Index `Month` enum from 1 #1551

Closed pitdicker closed 6 months ago

pitdicker commented 6 months ago

For 0.5 I'd like to make the Month enum less useless.

By defining Month::January as 1 users can do simple casting, and use it for example in:

let date = NaiveDate::from_ymd(2015, Month::March as u32, 14);

We can also choose to make Datelike::month return Month (#727). I didn't do so here for two reasons:

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.01%. Comparing base (08c9792) to head (bb658ae). Report is 5 commits behind head on 0.5.x.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## 0.5.x #1551 +/- ## ========================================== + Coverage 93.98% 94.01% +0.03% ========================================== Files 37 37 Lines 16656 16579 -77 ========================================== - Hits 15654 15587 -67 + Misses 1002 992 -10 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.