mirror of
https://github.com/chronotope/chrono.git
synced 2025-10-02 07:21:41 +00:00
docs: Improve deprecation of TimeZone::datetime_from_str
Add recommending using `NaiveDate::parse_from_str` as well
This commit is contained in:
parent
849932b09b
commit
6033afea6f
@ -469,7 +469,14 @@ pub trait TimeZone: Sized + Clone {
|
|||||||
///
|
///
|
||||||
/// See also [`DateTime::parse_from_str`] which gives a [`DateTime`] with
|
/// See also [`DateTime::parse_from_str`] which gives a [`DateTime`] with
|
||||||
/// parsed [`FixedOffset`].
|
/// parsed [`FixedOffset`].
|
||||||
#[deprecated(since = "0.4.29", note = "use `DateTime::parse_from_str` instead")]
|
///
|
||||||
|
/// See also [`NaiveDateTime::parse_from_str`] which gives a [`NaiveDateTime`] without
|
||||||
|
/// an offset, but can be converted to a [`DateTime`] with [`NaiveDateTime::and_utc`] or
|
||||||
|
/// [`NaiveDateTime::and_local_timezone`].
|
||||||
|
#[deprecated(
|
||||||
|
since = "0.4.29",
|
||||||
|
note = "use `DateTime::parse_from_str` or `NaiveDateTime::parse_from_str` with `and_utc()` or `and_local_timezone()` instead"
|
||||||
|
)]
|
||||||
fn datetime_from_str(&self, s: &str, fmt: &str) -> ParseResult<DateTime<Self>> {
|
fn datetime_from_str(&self, s: &str, fmt: &str) -> ParseResult<DateTime<Self>> {
|
||||||
let mut parsed = Parsed::new();
|
let mut parsed = Parsed::new();
|
||||||
parse(&mut parsed, s, StrftimeItems::new(fmt))?;
|
parse(&mut parsed, s, StrftimeItems::new(fmt))?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user