Skip to main content

days_in_month

Function days_in_month 

Source
pub const fn days_in_month(year: i32, month: u8) -> u8
Expand description

Number of days in the given month of the given year (leap-year aware). Returns 0 for an out-of-range month.

ยงExamples

use ssg::dates::days_in_month;

assert_eq!(days_in_month(2026, 7), 31);
assert_eq!(days_in_month(2024, 2), 29); // leap February
assert_eq!(days_in_month(2026, 2), 28);
assert_eq!(days_in_month(2026, 13), 0); // out of range