[][src]Function chronoutil::delta::with_day

pub fn with_day<D: Datelike>(date: D, day: u32) -> Option<D>

Shift the date to have the given day. Returns None if the day is not in the range 1-31.

Ambiguous month-ends are shifted backwards as necessary. For example:

let start = NaiveDate::from_ymd(2020, 2, 1);
assert_eq!(with_day(start, 31), Some(NaiveDate::from_ymd(2020, 2, 29)));
assert_eq!(with_day(start, 42), None);