Remove usage of deprecated date() method.

As the date_naive() method (recommended replacement for date()) does not
contain tz information, we need to add it back using
and_local_timezone().
This commit is contained in:
Orne Brocaar 2023-02-06 12:34:15 +00:00
parent 5953542a72
commit 8d34bb0d0c

View File

@ -232,16 +232,20 @@ pub async fn get(
// than 24h and we end up with the same day. Therefore we increment by two // than 24h and we end up with the same day. Therefore we increment by two
// days. // days.
(ts + ChronoDuration::days(2)) (ts + ChronoDuration::days(2))
.date() .date_naive()
.and_hms_opt(0, 0, 0) .and_hms_opt(0, 0, 0)
.unwrap() .unwrap()
.and_local_timezone(Local)
.unwrap()
} else { } else {
// Make sure that the timestamp stays at midnight in case of non-DST to DST // Make sure that the timestamp stays at midnight in case of non-DST to DST
// change. // change.
(ts + ChronoDuration::days(1)) (ts + ChronoDuration::days(1))
.date() .date_naive()
.and_hms_opt(0, 0, 0) .and_hms_opt(0, 0, 0)
.unwrap() .unwrap()
.and_local_timezone(Local)
.unwrap()
} }
}; };
} }