UNPKG

@northguild/gmt

Version:

Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.

19 lines • 932 B
/** * Resolve a two-digit year inside a caller-chosen hundred-year window: the one year in * `[windowStart, windowStart + 99]` whose last two digits are `yy`. * * Pure arithmetic: the function holds no window of its own and reads no clock. The window comes * from the caller's `TwoDigitYearOptions.yearWindow`, resolved by `readYearWindowStart` * (`internal/yearWindowStart.ts`); no standard says which century a two-digit year belongs to, * so the library never supplies one. * * @param yy the two-digit year, 0–99, as the grammar read it * @param windowStart the first year of the hundred-year window * @returns the four-digit year in the window ending in `yy` * * @example twoDigitYear(24, 2000) // 2024 * @example twoDigitYear(99, 1950) // 1999 * @example twoDigitYear(49, 1950) // 2049 * @example twoDigitYear(0, 1976) // 2000 */ export declare function twoDigitYear(yy: number, windowStart: number): number;