UNPKG

@burglekitt/gmt

Version:

Temporal-based date and time utilities with timezone support and polyfill integration

25 lines (24 loc) 1.03 kB
/** * Return true if `value1` and `value2` form a valid Unix range — both finite numbers * and `value1 <= value2`. * * - Both inputs must be numbers (or numeric strings that coerce to finite numbers). * - Equal `value1 === value2` is valid when `options.allowEqual` is true. * - Non-finite values (NaN, Infinity) return `false`. * * @param value1 first Unix epoch value (seconds or milliseconds) * @param value2 second Unix epoch value (seconds or milliseconds) * @param options optional allowEqual flag * @returns boolean indicating whether the Unix range is valid * * @example isValidUnixRange({ value1: 0, value2: 1700000000 }) // true * @example isValidUnixRange({ value1: 1700000000, value2: 0 }) // false * @example isValidUnixRange({ value1: 1000, value2: 1000, options: { allowEqual: true } }) // true */ export declare function isValidUnixRange({ value1, value2, options, }: { value1: number | string; value2: number | string; options?: { allowEqual?: boolean; }; }): boolean;