chore(docs): remove usage of deprecated methods

This commit is contained in:
Erica Marigold 2023-08-23 19:09:11 +05:30
parent aa1befecb3
commit 2a7ebcc019
No known key found for this signature in database
GPG key ID: 23CD97ABBBCC5ED2
2 changed files with 14 additions and 4 deletions

View file

@ -25,7 +25,13 @@ Please see ['chrono`'s documentation](https://docs.rs/chrono/).
To format a chrono `Date` or `DateTime` object, you can use the `formatl` method:
```
let dt = FixedOffset::east(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_708);
let dt = FixedOffset::east_opt(34200)
.unwrap()
.with_ymd_and_hms(2001, 7, 8, 0, 34, 59)
.unwrap()
.with_nanosecond(1_026_490_708)
.unwrap();
println!("{}", dt.formatl("%c", "fr"));
```

View file

@ -27,12 +27,16 @@
//! To format a chrono `Date` or `DateTime` object, you can use the `formatl` method:
//!
//! ```rust
//! # extern crate chrono;
//! # extern crate chrono_locale;
//! # use chrono::prelude::*;
//! # use chrono_locale::LocaleDate;
//!
//! let dt = FixedOffset::east(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_708);
//! let dt = FixedOffset::east_opt(34200)
//! .unwrap()
//! .with_ymd_and_hms(2001, 7, 8, 0, 34, 59)
//! .unwrap()
//! .with_nanosecond(1_026_490_708)
//! .unwrap();
//!
//! println!("{}", dt.formatl("%c", "fr"));
//! ```
//!