Function chronoutil::delta::with_month [−][src]
pub fn with_month<D: Datelike>(date: D, month: u32) -> Option<D>
Shift the date to have the given month. Returns None if the month is out of range.
Ambiguous month-ends are shifted backwards as necessary. For example:
let start = NaiveDate::from_ymd(2020, 1, 31); assert_eq!(with_month(start, 2), Some(NaiveDate::from_ymd(2020, 2, 29))); assert_eq!(with_month(start, 13), None);