@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.
14 lines • 716 B
TypeScript
/**
* Compare two unix epoch values as instants, for the unix comparison predicates.
*
* @param value1 first epoch value (number or digit string)
* @param value2 second epoch value
* @param options optional `{ epochUnit }` (milliseconds by default; singular names accepted)
* @returns `Temporal.Instant.compare`'s -1, 0 or 1, or null when the unit or either value is invalid
* @example compareUnixEpochs(0, "1000") // -1
* @example compareUnixEpochs("1706659200", 1706659200, { epochUnit: "second" }) // 0
* @example compareUnixEpochs(0, 1.5) // null (not an integer epoch)
*/
export declare function compareUnixEpochs(value1: unknown, value2: unknown, options?: {
epochUnit?: unknown;
}): number | null;