pub fn add_months(date: NaiveDate, months: u32) -> NaiveDateExpand description
Add months calendar months to a NaiveDate, clamping the day to the
last valid day of the target month.
§Examples
use chrono::NaiveDate;
use datasynth_core::models::generation_session::add_months;
let d = NaiveDate::from_ymd_opt(2024, 1, 31).unwrap();
// Jan 31 + 1 month → Feb 29 (2024 is a leap year)
assert_eq!(add_months(d, 1), NaiveDate::from_ymd_opt(2024, 2, 29).unwrap());