From 1975e766dbaeaffaf5cfdf8b926d5d1e041b8b34 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Fri, 15 Nov 2024 23:59:13 +0100 Subject: [PATCH] Replace calls to deprecated functions with a recommended replacements --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 4329c24..f94c823 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -54,7 +54,7 @@ fn rfc2822>(string: T) -> Option> { fn utc_datetime(string: &str, format: &str) -> Option> { NaiveDateTime::parse_from_str(string, format) - .map(|d| DateTime::from_utc(d, Utc)) + .map(|d| Utc.from_utc_datetime(&d)) .ok() .map(|d: DateTime| d.into()) } @@ -63,7 +63,7 @@ fn utc_date(string: &str, format: &str) -> Option> { let date = NaiveDate::parse_from_str(string, format).ok()?; let time = NaiveTime::from_hms_opt(0, 0, 0)?; let datetime = NaiveDateTime::new(date, time); - Some(DateTime::::from_utc(datetime, Utc).into()) + Some(Utc.from_utc_datetime(&datetime).into()) } /// Parses a string using multiple formats