Skip to content

Commit

Permalink
docs: Improve deprecation of TimeZone::datetime_from_str
Browse files Browse the repository at this point in the history
Add recommending using `NaiveDate::parse_from_str` as well
  • Loading branch information
tmccombs authored and djc committed Jan 4, 2024
1 parent 849932b commit 6033afe
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/offset/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,14 @@ pub trait TimeZone: Sized + Clone {
///
/// See also [`DateTime::parse_from_str`] which gives a [`DateTime`] with
/// 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>> {
let mut parsed = Parsed::new();
parse(&mut parsed, s, StrftimeItems::new(fmt))?;
Expand Down

0 comments on commit 6033afe

Please sign in to comment.