@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.
26 lines • 1.6 kB
TypeScript
/**
* The nanoseconds since the Unix epoch of a plain ISO wall-clock date-time read as if it were UTC
* (an Arrow `Timestamp` with no time zone), or `null` for text `isValidDateTime` rejects (an
* offset, a leap second, a non-ISO calendar). A bracketed time zone is ignored. Counting whole
* days, then the time of day, covers every `PlainDateTime`, including the day past each end of
* the instant range that `toZonedDateTime` refuses.
*/
export declare function wallClockNanoseconds(value: unknown): bigint | null;
/**
* The wall-clock date-time string for nanoseconds since the Unix epoch, the inverse of
* `wallClockNanoseconds`. "" for `null` and for a count outside the `PlainDateTime` range.
*/
export declare function wallClockString(nanoseconds: bigint | null): string;
/** Whether `nanoseconds` is a count an Arrow `int64` of nanoseconds can hold. */
export declare function fitsInt64(nanoseconds: unknown): boolean;
/**
* The epoch nanoseconds an Arrow `int64` `value` in `unit` names, or `null` when `value` is not
* an `int64` bigint or `unit` is not an Arrow `TimeUnit`. The range of instants is not checked.
*/
export declare function arrowNanoseconds(value: unknown, unit: unknown): bigint | null;
/**
* The Arrow `int64` count for epoch nanoseconds in one unit (floored toward negative infinity),
* or `0n` when the input, the unit or the result is invalid. The caller has range-checked the
* value: `parseInstantNanoseconds` and `wallClockNanoseconds` return only in-range counts.
*/
export declare function arrowCount(nanoseconds: bigint | null, unit: unknown): bigint;