Skip to content

Commit

Permalink
chore: fix deprecated method in tests "DateTime::from_utc"
Browse files Browse the repository at this point in the history
  • Loading branch information
beltram committed Sep 22, 2023
1 parent cd62b88 commit 9d07525
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/tests/resp/template/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ async fn should_template_now_with_custom_timezone() {

fn is_close_to(from: String, rounding: Duration, alter: fn(DateTime<Utc>) -> DateTime<Utc>) {
let parsed = DateTime::<FixedOffset>::parse_from_rfc3339(from.as_str()).unwrap();
let received: DateTime<Utc> = DateTime::from_utc(parsed.naive_utc(), Utc).duration_round(rounding).unwrap();
let received: DateTime<Utc> = DateTime::from_naive_utc_and_offset(parsed.naive_utc(), Utc)
.duration_round(rounding)
.unwrap();
let received = alter(received);
let approx_now = Utc::now().duration_round(rounding).unwrap();
assert_eq!(approx_now, received)
Expand Down

0 comments on commit 9d07525

Please sign in to comment.