UNPKG

@burglekitt/gmt

Version:

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

26 lines (25 loc) 1.67 kB
/** * Return true when `pointOrStart` falls within the interval `[intervalStart, intervalEnd]` * (3-arg), or when the inner interval `[innerStart, innerEnd]` is fully contained within * the outer interval `[intervalStart, intervalEnd]` (4-arg). * * - Compares numeric Unix epoch values directly. * - Always-inclusive boundaries: `start <= point <= end`. * - Returns `false` if `intervalStart > intervalEnd` (invalid outer interval). * - Returns `false` if `innerStart > innerEnd` in 4-arg mode (invalid inner interval). * - Returns `false` on invalid input (non-numeric types, non-finite values). * * @param intervalStart Unix epoch value (seconds or milliseconds) — outer interval start * @param intervalEnd Unix epoch value (seconds or milliseconds) — outer interval end * @param pointOrStart Unix epoch value for the point (3-arg) or inner start (4-arg) * @param pointEnd optional Unix epoch value for the inner interval end (4-arg mode) * @returns true if the point or inner interval is contained, or false on invalid input * * @example intervalContainsUnix(0, 1700000000, 170000000) // true * @example intervalContainsUnix(0, 1700000000, 170000000, 1500000000) // true * @example intervalContainsUnix(1700000000, 0, 170000000) // false * @example intervalContainsUnix(0, 1700000000, 170000000, 15000000) // false * @example intervalContainsUnix(NaN, 1700000000, 170000000) // false * @example intervalContainsUnix("0", "1700000000", "170000000") // true */ export declare function intervalContainsUnix(intervalStart: number | string, intervalEnd: number | string, pointOrStart: number | string, pointEnd?: number | string): boolean;