diff --git a/src/naive/mod.rs b/src/naive/mod.rs index a64f848d4..5df3b15a6 100644 --- a/src/naive/mod.rs +++ b/src/naive/mod.rs @@ -73,9 +73,13 @@ impl NaiveWeek { /// ``` /// use chrono::{NaiveDate, Weekday}; /// - /// let date = NaiveDate::from_ymd_opt(2022, 4, 18).unwrap(); + /// let date = NaiveDate::MIN; /// let week = date.week(Weekday::Mon); - /// assert!(week.checked_first_day().unwrap() <= date); + /// let Some(first_day) = week.checked_first_day() else { + /// // error handling code + /// return; + /// }; + /// assert!(first_day == date); /// ``` #[inline] #[must_use] @@ -120,9 +124,13 @@ impl NaiveWeek { /// ``` /// use chrono::{NaiveDate, Weekday}; /// - /// let date = NaiveDate::from_ymd_opt(2022, 4, 18).unwrap(); + /// let date = NaiveDate::MAX; /// let week = date.week(Weekday::Mon); - /// assert!(week.checked_last_day().unwrap() >= date); + /// let Some(last_day) = week.checked_last_day() else { + /// // error handling code + /// return; + /// }; + /// assert!(last_day == date); /// ``` #[inline] #[must_use] @@ -170,14 +178,15 @@ impl NaiveWeek { /// /// # Examples /// - /// todo: examples with min/max /// ``` /// use chrono::{NaiveDate, Weekday}; /// - /// let date = NaiveDate::from_ymd_opt(2022, 4, 18).unwrap(); + /// let date = NaiveDate::MAX; /// let week = date.week(Weekday::Mon); - /// let days = week.checked_days().unwrap(); - /// assert!(days.contains(&date)); + /// let Some(_days) = week.checked_days() else { + /// // error handling code + /// return; + /// }; /// ``` #[inline] #[must_use]