pub struct NaiveWeek { /* private fields */ }
Expand description
Implementations
sourceimpl NaiveWeek
impl NaiveWeek
sourcepub fn first_day(&self) -> NaiveDate
pub fn first_day(&self) -> NaiveDate
Returns a date representing the first day of the week.
Examples
use chrono::{NaiveDate, Weekday};
let date = NaiveDate::from_ymd_opt(2022, 4, 18).unwrap();
let week = date.week(Weekday::Mon);
assert!(week.first_day() <= date);
sourcepub fn last_day(&self) -> NaiveDate
pub fn last_day(&self) -> NaiveDate
Returns a date representing the last day of the week.
Examples
use chrono::{NaiveDate, Weekday};
let date = NaiveDate::from_ymd_opt(2022, 4, 18).unwrap();
let week = date.week(Weekday::Mon);
assert!(week.last_day() >= date);
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for NaiveWeek
impl Send for NaiveWeek
impl Sync for NaiveWeek
impl Unpin for NaiveWeek
impl UnwindSafe for NaiveWeek
Blanket Implementations
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more