UNPKG

@burglekitt/gmt

Version:

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

22 lines (21 loc) 1.34 kB
/** * Return true when intervals `[aStart, aEnd]` and `[bStart, bEnd]` share at least one instant. * * - Compares numeric Unix epoch values directly. * - Adjacent intervals (e.g. `aEnd === bStart`) do NOT overlap — returns `false`. * - Returns `false` if either interval is invalid (`start > end`). * - Returns `false` on invalid input (non-numeric types, non-finite values). * * @param aStart Unix epoch value (seconds or milliseconds) — first interval start * @param aEnd Unix epoch value (seconds or milliseconds) — first interval end * @param bStart Unix epoch value (seconds or milliseconds) — second interval start * @param bEnd Unix epoch value (seconds or milliseconds) — second interval end * @returns true if intervals overlap, or false on invalid input * * @example intervalsOverlapUnix(0, 1700000000, 1000000, 2000000) // true * @example intervalsOverlapUnix(0, 1000000, 1000000, 2000000) // false (adjacent) * @example intervalsOverlapUnix(0, 1000000, 1000001, 2000000) // false (disjoint) * @example intervalsOverlapUnix(NaN, 1700000000, 1000000, 2000000) // false * @example intervalsOverlapUnix("0", "1700000000", "1000000", "2000000") // true */ export declare function intervalsOverlapUnix(aStart: number | string, aEnd: number | string, bStart: number | string, bEnd: number | string): boolean;