diff options
| author | Noah Lev <camelidcamel@gmail.com> | 2024-07-08 14:19:11 -0700 |
|---|---|---|
| committer | Tshepang Mbambo <tshepang@gmail.com> | 2024-07-09 08:20:59 +0200 |
| commit | b1ab88c5605c4b32f48f6c353545c0cd570e86e1 (patch) | |
| tree | 8e71c06290d56850447fcc4c1961dab079ee7e0e | |
| parent | b565e17230dbe8a05f0e82e8747a1142afec05d6 (diff) | |
| download | rust-b1ab88c5605c4b32f48f6c353545c0cd570e86e1.tar.gz rust-b1ab88c5605c4b32f48f6c353545c0cd570e86e1.zip | |
Fix chrono deprecations
| -rw-r--r-- | src/doc/rustc-dev-guide/ci/date-check/src/main.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/doc/rustc-dev-guide/ci/date-check/src/main.rs b/src/doc/rustc-dev-guide/ci/date-check/src/main.rs index d9e8145a318..5ab3e6c8b65 100644 --- a/src/doc/rustc-dev-guide/ci/date-check/src/main.rs +++ b/src/doc/rustc-dev-guide/ci/date-check/src/main.rs @@ -19,8 +19,12 @@ struct Date { impl Date { fn months_since(self, other: Date) -> Option<u32> { - let self_chrono = Utc.ymd(self.year.try_into().unwrap(), self.month, 1); - let other_chrono = Utc.ymd(other.year.try_into().unwrap(), other.month, 1); + let self_chrono = Utc + .with_ymd_and_hms(self.year.try_into().unwrap(), self.month, 1, 0, 0, 0) + .unwrap(); + let other_chrono = Utc + .with_ymd_and_hms(other.year.try_into().unwrap(), other.month, 1, 0, 0, 0) + .unwrap(); let duration_since = self_chrono.signed_duration_since(other_chrono); let months_since = duration_since.num_days() / 30; if months_since < 0 { @@ -133,7 +137,7 @@ fn main() { let root_dir = args.nth(1).unwrap(); let root_dir_path = Path::new(&root_dir); let glob_pat = format!("{}/**/*.md", root_dir); - let today_chrono = Utc::today(); + let today_chrono = Utc::now().date_naive(); let current_month = Date { year: today_chrono.year_ce().1, month: today_chrono.month(), |
