UNPKG

@burglekitt/gmt

Version:

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

23 lines (22 loc) 1.4 kB
/** * Return true when two Unix intervals are exactly adjacent — one's end equals the other's * start minus 1 (no gap, no overlap). * * - Compares numeric Unix epoch values directly. * - Returns `true` when `aEnd + 1 === bStart` or `bEnd + 1 === aStart`. * - Returns `false` when intervals overlap, are disjoint with a gap, or are invalid. * - 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 are exactly adjacent, or false on invalid input * * @example intervalAbutsUnix(0, 1500000000, 1500000001, 1700000000) // true * @example intervalAbutsUnix(1500000001, 1700000000, 0, 1500000000) // true * @example intervalAbutsUnix(0, 1500000000, 1500000002, 1700000000) // false (gap) * @example intervalAbutsUnix(0, 1500000001, 1500000000, 1700000000) // false (overlap) * @example intervalAbutsUnix(NaN, 1500000000, 1500000001, 1700000000) // false */ export declare function intervalAbutsUnix(aStart: number | string, aEnd: number | string, bStart: number | string, bEnd: number | string): boolean;