olliemath / chronoutil

ChronoUtil module provides powerful extensions to rust's Chrono crate.
MIT License
21 stars 9 forks source link

Fix shift_months and add relevant tests #1

Closed reisnera closed 3 years ago

reisnera commented 3 years ago

Hey there!

I found a bug in shift_months that resulted in a panic due to (in this case) the months calculation. Here's an example:

let base = NaiveDate::from_ymd(2020, 12, 1);
let d = shift_months(base, 1);

This PR fixes it (I believe...) and adds relevant tests. I'm happy to respond/adjust to feedback if you have any!

olliemath commented 3 years ago

Hey Alex, thanks for the good PR. Great catch! I'll prepare a new release with the fix