pub enum DateUnit {
Year,
Month,
Day,
}Expand description
Date units for functions like Date::get or Date::apply.
Variants
Year
Month
Note: When used in the Date::apply function, this unit adds or removes calendar months, not 30 days.
let date = Date::from_ymd(1970, 1, 31).unwrap();
assert_eq!("1970-02-28", date.apply(1, DateUnit::Month).unwrap().format("yyyy-MM-dd"));
assert_eq!("1970-03-31", date.apply(2, DateUnit::Month).unwrap().format("yyyy-MM-dd"));
assert_eq!("1970-04-30", date.apply(3, DateUnit::Month).unwrap().format("yyyy-MM-dd"));Day
Trait Implementations
sourceimpl PartialEq<DateUnit> for DateUnit
impl PartialEq<DateUnit> for DateUnit
impl Eq for DateUnit
impl StructuralEq for DateUnit
impl StructuralPartialEq for DateUnit
Auto Trait Implementations
impl RefUnwindSafe for DateUnit
impl Send for DateUnit
impl Sync for DateUnit
impl Unpin for DateUnit
impl UnwindSafe for DateUnit
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more