From 8481026c5ff550e2ac57cc28c40079aac620fab2 Mon Sep 17 00:00:00 2001 From: Greg Leonard <45019882+greg-el@users.noreply.github.com> Date: Wed, 18 Jan 2023 18:46:12 +0000 Subject: [PATCH] Update deprecated methods in `from_utc` example `from_timestamp` and `Utc.timestamp` are deprecated, and have been replaced with `from_timestamp_opt` and `Utc.timestamp_opt` respectively, with unwrapping. --- src/datetime/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/datetime/mod.rs b/src/datetime/mod.rs index 05d0458e84..00450ce9c7 100644 --- a/src/datetime/mod.rs +++ b/src/datetime/mod.rs @@ -107,8 +107,8 @@ impl DateTime { /// ``` /// use chrono::{DateTime, TimeZone, NaiveDateTime, Utc}; /// - /// let dt = DateTime::::from_utc(NaiveDateTime::from_timestamp(61, 0), Utc); - /// assert_eq!(Utc.timestamp(61, 0), dt); + /// let dt = DateTime::::from_utc(NaiveDateTime::from_timestamp_opt(61, 0).unwrap(), Utc); + /// assert_eq!(Utc.timestamp_opt(61, 0).unwrap(), dt); /// ``` // // note: this constructor is purposely not named to `new` to discourage the direct usage.