Skip to main content

ymd_from_i32

Function ymd_from_i32 

pub(crate) fn ymd_from_i32(component: i32) -> u32
Expand description

Converts a year, month, or day-of-month component computed in i32 back to u32.

The inverse of ymd_to_i32, for a component that went through signed arithmetic — a month rolled back across a year boundary, say — and has been normalised into range again.

§Panics

Panics if component is negative. Every caller normalises first, with rem_euclid or a carry loop, so a negative here means the normalisation was dropped rather than that the input was bad.