Skip to main content

last_day_of_month

Function last_day_of_month 

pub fn last_day_of_month(date: NaiveDate) -> NaiveDate
Expand description

The last calendar day of date’s month — calendar-blind: it ignores weekends and holidays, so it can land on a day no market is open.

This is the calendar month end. The business month end is Calendar::end_of_month, which rolls this day back to the month’s last good business day; the two differ whenever a month ends on a weekend or a holiday. Take this one when the month’s shape is what matters (a roll convention, a day-of-month clamp) and the business one when a market must be open on the result.

§Panics

Never for a NaiveDate that exists: the first of the following month and the day before it are both in range for every representable date. A panic here would mean chrono had produced a date it cannot represent.