diff options
| author | Joris | 2022-12-18 15:03:51 +0100 | 
|---|---|---|
| committer | Joris | 2022-12-18 15:03:51 +0100 | 
| commit | a6fd0110b65ec352603d69b9c4ccf3532689cd32 (patch) | |
| tree | f6f8694a40ce620705525f1aca67edeba3074c0b /src/model | |
| parent | 241089e3a1427c2968b296cc6c4112e45b78c278 (diff) | |
Upgrade dependencies
Diffstat (limited to 'src/model')
| -rw-r--r-- | src/model/repetition.rs | 15 | 
1 files changed, 9 insertions, 6 deletions
| diff --git a/src/model/repetition.rs b/src/model/repetition.rs index 155545f..6151cbf 100644 --- a/src/model/repetition.rs +++ b/src/model/repetition.rs @@ -80,8 +80,9 @@ impl Repetition {                  Box::new(|d| first_weekday_of_month(next_month(d), weekday)),              ),              Frequency::Yearly => repeat( -                NaiveDate::from_ymd(event.year(), event.month(), event.day()), -                Box::new(|d| NaiveDate::from_ymd(d.year() + 1, d.month(), d.day())), +                // TODO: error handling +                NaiveDate::from_ymd_opt(event.year(), event.month(), event.day()).unwrap(), +                Box::new(|d| NaiveDate::from_ymd_opt(d.year() + 1, d.month(), d.day()).unwrap()),              ),          }      } @@ -97,14 +98,16 @@ impl Repetition {  }  fn first_weekday_of_month(date: NaiveDate, weekday: Weekday) -> NaiveDate { -    NaiveDate::from_weekday_of_month(date.year(), date.month(), weekday, 1) +    // TODO: error handling +    NaiveDate::from_weekday_of_month_opt(date.year(), date.month(), weekday, 1).unwrap()  }  fn next_month(date: NaiveDate) -> NaiveDate { +    // TODO: error handling      if date.month() == 12 { -        NaiveDate::from_ymd(date.year() + 1, 1, date.day()) +        NaiveDate::from_ymd_opt(date.year() + 1, 1, date.day()).unwrap()      } else { -        NaiveDate::from_ymd(date.year(), date.month() + 1, date.day()) +        NaiveDate::from_ymd_opt(date.year(), date.month() + 1, date.day()).unwrap()      }  } @@ -290,7 +293,7 @@ mod tests {      }      fn d(y: i32, m: u32, d: u32) -> NaiveDate { -        NaiveDate::from_ymd(y, m, d) +        NaiveDate::from_ymd_opt(y, m, d)      }      fn from_freq(frequency: Frequency) -> Repetition { | 
