@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.
24 lines • 1.53 kB
TypeScript
/**
* The instant a date on the epoch day or the day before is read at instead, with its era side (1
* for the Hijra and after, -1 before it), or `null` when the instant needs no move: the calendar
* is not islamic, the engine has no D32, the local date is not at risk or no same-time twin exists.
*
* @example epochTwin(Date.UTC(622, 6, 19), "islamic-civil", "UTC") // { ms: 74417-day-later instant, side: 1 }
*/
export declare function epochTwin(ms: number, calendar: string, timeZone: string): {
readonly ms: number;
readonly side: -1 | 1;
} | null;
/**
* The formatter itself, or a wrapper that prints the first day of year 1 of an islamic calendar as
* year 1 in the era AH, and the last day of year 0 as the formatter prints any other date before
* the Hijra, where the engine changes the era in the middle of the day (D32).
*
* @param formatter the formatter the earlier repairs returned
* @param callerOptions the options it was built with
* @returns the formatter, or its wrapper
*
* @example repairIslamicEpochEra(new Intl.DateTimeFormat("en-u-ca-gregory"), {}) // the same formatter
* @example repairIslamicEpochEra(new Intl.DateTimeFormat("en-u-ca-islamic-civil", { era: "short", year: "numeric", timeZone: "UTC" }), { era: "short", year: "numeric", timeZone: "UTC" }).format(Date.UTC(622, 6, 19)) // "1 AH" where the engine prints "0 Before Hijra"
*/
export declare function repairIslamicEpochEra(formatter: Intl.DateTimeFormat, callerOptions: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;