Merge pull request #1539 from tmccombs/fix-clippy

Fix deprecation warning.
This commit is contained in:
Tavian Barnes 2024-04-28 17:21:41 -04:00 committed by GitHub
commit ae1de4de24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,4 @@
use chrono::{DateTime, Local, NaiveDate, NaiveDateTime, Utc};
use chrono::{DateTime, Local, NaiveDate, NaiveDateTime};
use std::time::SystemTime;
@ -33,10 +33,7 @@ impl TimeFilter {
})
.or_else(|| {
let timestamp_secs = s.strip_prefix('@')?.parse().ok()?;
NaiveDateTime::from_timestamp_opt(timestamp_secs, 0)?
.and_local_timezone(Utc)
.latest()
.map(Into::into)
DateTime::from_timestamp(timestamp_secs, 0).map(Into::into)
})
.map(|dt| dt.into())
})