diff options
author | Ellie Huxtable <ellie@elliehuxtable.com> | 2022-12-18 18:27:20 +0000 |
---|---|---|
committer | Ellie Huxtable <ellie@elliehuxtable.com> | 2022-12-18 18:27:24 +0000 |
commit | 64556d6dce538b712726b65549e30e273542acd9 (patch) | |
tree | 9c0ffc722aa88ce4c75f5dbe47d126ee5f1f770b | |
parent | 40d880a877bac417e0f0482c8670164855155360 (diff) |
Deprecated usage 1 fixedellie/update-things
-rw-r--r-- | atuin-common/src/utils.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/atuin-common/src/utils.rs b/atuin-common/src/utils.rs index 59545a26..99338d5d 100644 --- a/atuin-common/src/utils.rs +++ b/atuin-common/src/utils.rs @@ -29,7 +29,7 @@ pub fn data_dir() -> PathBuf { } pub fn get_days_from_month(year: i32, month: u32) -> i64 { - NaiveDate::from_ymd( + NaiveDate::from_ymd_opt( match month { 12 => year + 1, _ => year, @@ -40,7 +40,8 @@ pub fn get_days_from_month(year: i32, month: u32) -> i64 { }, 1, ) - .signed_duration_since(NaiveDate::from_ymd(year, month, 1)) + .expect("Invalid month") + .signed_duration_since(NaiveDate::from_ymd_opt(year, month, 1).expect("Invalid month")) .num_days() } |