@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.25 kB
TypeScript
import { UnixUnit } from "../validate/isValidUnixUnit.js";
/**
* Return whether `value1` represents an instant strictly after `value2`.
*
* - Uses Temporal.Instant.compare to check ordering.
* - Each value is a safe integer or a string of optionally negative ASCII digits; anything else
* is invalid.
* - Returns false if either input is invalid.
*
* @param value1 first unix epoch: a safe integer or a digit string
* @param value2 second unix epoch, in the same unit
* @param options optional: how both epochs are read
* @returns `true` if `value1` is after `value2`, otherwise `false`
*
* @example isAfterUnix(1706659200, 1704067200) // true
* @example isAfterUnix(1706659200, 1706659200) // false
* @example isAfterUnix(-1, 0) // false
* @example isAfterUnix("1706659200", "1704067200") // true (digit strings)
* @example isAfterUnix(" 1706659200", 1704067200) // false (a padded string is not an epoch)
*/
export declare function isAfterUnix(value1: number | string, value2: number | string, options?: {
/**
* The unit the epoch values are counted in: `"seconds"` or `"milliseconds"`, singular or
* plural. Any other value returns `false`.
*
* @defaultValue `"milliseconds"`
*/
epochUnit?: UnixUnit;
}): boolean;