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