@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.
29 lines • 1.62 kB
TypeScript
/**
* The sampling step: 5 days. It must stay under the smallest gap between two offset changes of
* one zone, 601,200 s in tz 2026c (`zdump -v`, America/Boa_Vista 2000-10-08 to 2000-10-15).
*/
export declare const TRANSITION_SEARCH_STEP_NANOSECONDS: bigint;
/** Forget every remembered span. Internal; tests call it to start from a cold memo. */
export declare function clearTransitionMemo(): void;
/**
* TC39 `GetNamedTimeZoneNextTransition`: the first offset change strictly after `from`.
*
* @param timeZone a named zone
* @param from the instant to search after (exclusive)
* @param until optional: the last instant to search (inclusive); a later change returns null
* @returns the change's epoch nanoseconds, or null when there is none up to `until` or none within
* three years of the later of `from` and the current instant
* @throws RangeError past `MAX_SEARCH_STEPS` steps
*/
export declare function nextTransitionAfter(timeZone: string, from: bigint, until?: bigint): bigint | null;
/**
* TC39 `GetNamedTimeZonePreviousTransition`: the last offset change strictly before `from`.
*
* @param timeZone a named zone
* @param from the instant to search before (exclusive)
* @param since optional: the search stops here (exclusive); an earlier change returns null
* @returns the change's epoch nanoseconds, or null when there is none after `since`, or, with no
* `since`, none at all
* @throws RangeError past `MAX_SEARCH_STEPS` steps or `MAX_TABLED_TRANSITIONS` tabled changes
*/
export declare function previousTransitionBefore(timeZone: string, from: bigint, since?: bigint): bigint | null;