From 88f91210cf0e22fa880828835a75e1a0b13606ec Mon Sep 17 00:00:00 2001 From: "Maximilien R." Date: Tue, 6 Aug 2024 23:40:55 +0200 Subject: [PATCH] Fix (Naive)DateTime warning on UTC conversion --- src/model/s3/lifecycle_worker.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/model/s3/lifecycle_worker.rs b/src/model/s3/lifecycle_worker.rs index 9ecf168c..d884d30f 100644 --- a/src/model/s3/lifecycle_worker.rs +++ b/src/model/s3/lifecycle_worker.rs @@ -388,15 +388,12 @@ fn check_size_filter(version_data: &ObjectVersionData, filter: &LifecycleFilter) fn midnight_ts(date: NaiveDate) -> u64 { date.and_hms_opt(0, 0, 0) .expect("midnight does not exist") - .timestamp_millis() as u64 + .and_utc().timestamp_millis() as u64 } fn next_date(ts: u64) -> NaiveDate { - NaiveDateTime::from_timestamp_millis(ts as i64) - .expect("bad timestamp") - .date() - .succ_opt() - .expect("no next day") + DateTime::from_timestamp_millis(ts as i64) + .expect("bad timestamp").date_naive() } fn today() -> NaiveDate {