MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / days_in_month

Function days_in_month

src/timeutil.rs:287–295  ·  view source on GitHub ↗
(year: i32, month: u32)

Source from the content-addressed store, hash-verified

285}
286
287fn days_in_month(year: i32, month: u32) -> u32 {
288 match month {
289 1 | 3 | 5 | 7 | 8 | 10 | 12 => 31,
290 4 | 6 | 9 | 11 => 30,
291 2 if is_leap_year(year) => 29,
292 2 => 28,
293 _ => 0,
294 }
295}
296
297fn is_leap_year(year: i32) -> bool {
298 year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)

Callers 3

parse_rfc3339_timestampFunction · 0.85

Calls 1

is_leap_yearFunction · 0.85

Tested by

no test coverage detected