Skip to content

Commit

Permalink
Update deprecated methods in from_utc example
Browse files Browse the repository at this point in the history
`from_timestamp` and `Utc.timestamp` are deprecated, and have been replaced with `from_timestamp_opt` and `Utc.timestamp_opt` respectively, with unwrapping.
  • Loading branch information
greg-el authored and djc committed Jan 19, 2023
1 parent 7c5e631 commit b244b83
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/datetime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ impl<Tz: TimeZone> DateTime<Tz> {
/// ```
/// use chrono::{DateTime, TimeZone, NaiveDateTime, Utc};
///
/// let dt = DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(61, 0), Utc);
/// assert_eq!(Utc.timestamp(61, 0), dt);
/// let dt = DateTime::<Utc>::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.
Expand Down

0 comments on commit b244b83

Please sign in to comment.