@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.39 kB
TypeScript
/**
* Smallest epoch-nanosecond value `Temporal.Instant` can represent:
* -10^8 days from the Unix epoch, i.e. `-271821-04-20T00:00:00Z`.
*/
export declare const MIN_EPOCH_NANOSECONDS = -8640000000000000000000n;
/**
* Largest epoch-nanosecond value `Temporal.Instant` can represent:
* +10^8 days from the Unix epoch, i.e. `+275760-09-13T00:00:00Z`.
*/
export declare const MAX_EPOCH_NANOSECONDS = 8640000000000000000000n;
/** TC39 `CheckISODaysRange`: a date may sit at most 10^8 days from the Unix epoch. */
export declare const MAX_ISO_EPOCH_DAYS = 100000000;
/**
* Digits in `MAX_EPOCH_NANOSECONDS` (22) — the longest a decimal form of an in-range
* epoch-nanosecond value can be, sign excluded.
*/
export declare const MAX_EPOCH_NANOSECOND_DIGITS: number;
/**
* Type guard for an epoch-nanosecond value the `precision/` namespace accepts: a `bigint`
* inside the range `Temporal.Instant` can represent.
*
* Every `precision/` function gates on this, so anything one of them accepts is renderable
* by `fromNanoseconds` — a value outside the range has no instant to convert back to.
*
* @example isValidEpochNanoseconds(0n) // true
* @example isValidEpochNanoseconds(8_640_000_000_000_000_000_001n) // false
* @example isValidEpochNanoseconds(0) // false — number, not bigint
*/
export declare function isValidEpochNanoseconds(value: unknown): value is bigint;