@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.
21 lines • 1.15 kB
TypeScript
import { Temporal } from "../temporal.js";
export interface FieldKey {
year: number;
month: number;
day: number;
}
/** True when `date` is the last representable date, +275760-09-13. */
export declare function isLastRepresentableDate(date: Temporal.PlainDate): boolean;
/**
* The latest in-range ISO date whose `calendarId` key is at or before `target`, or `null` when
* `target` precedes the first representable date. Throws RangeError if the search fails to
* converge (callers return their sentinel).
*/
export declare function floorDateForFields(calendarId: string, target: FieldKey): Temporal.PlainDate | null;
/**
* `floorDateForFields` within `[from, from + days]` (clamped to the range): `null` when `target`
* precedes `from`, the window's last date when `target` is at or past it.
*/
export declare function floorDateForFieldsBetween(calendarId: string, target: FieldKey, from: Temporal.PlainDate, days: number): Temporal.PlainDate | null;
/** The ISO date (iso8601) whose `calendarId` fields are exactly `target`, or `null`. */
export declare function isoForFields(calendarId: string, target: FieldKey): Temporal.PlainDate | null;