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.

25 lines • 1.25 kB
import { Temporal } from "../temporal.js"; /** * Floored integer division remainder: the result has the sign of `divisor` (`mod(-1, 19)` is 18), * as the calendar formulas below require. JS `%` keeps the dividend's sign. */ export declare function mod(value: number, divisor: number): number; /** Proleptic Gregorian (ISO 8601) leap year. */ export declare function isIsoLeapYear(year: number): boolean; /** * The fixed day number (R.D.; 0001-01-01 is day 1) of a proleptic Gregorian date, per * Dershowitz & Reingold, *Calendrical Calculations* (3rd ed.), §2.2 `fixed-from-gregorian`. * Pure integer arithmetic, so it also works for dates outside the Temporal PlainDate range, which * the calendar arithmetic needs for year boundaries next to the minimum. * * @example fixedFromIso(1, 1, 1) // 1 * @example fixedFromIso(1970, 1, 1) // 719163 */ export declare function fixedFromIso(year: number, month: number, day: number): number; /** * The ISO-calendared PlainDate of a fixed day number. Throws RangeError outside the TC39 PlainDate * range (`ISODateWithinLimits`), through ISO day arithmetic. * * @example dateFromFixed(719163).toString() // "1970-01-01" */ export declare function dateFromFixed(fixed: number): Temporal.PlainDate;