@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
23 lines (22 loc) • 1.36 kB
TypeScript
/**
* Return true when interval B is fully contained within interval A — every instant of B
* falls within A.
*
* - Compares numeric Unix epoch values directly.
* - Equivalent to 4-argument `intervalContainsUnix(aStart, aEnd, bStart, bEnd)`.
* - 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) — outer interval start
* @param aEnd Unix epoch value (seconds or milliseconds) — outer interval end
* @param bStart Unix epoch value (seconds or milliseconds) — inner interval start
* @param bEnd Unix epoch value (seconds or milliseconds) — inner interval end
* @returns true if B is fully contained in A, or false on invalid input
*
* @example intervalEngulfsUnix(0, 1700000000, 1500000000, 1600000000) // true
* @example intervalEngulfsUnix(0, 1700000000, 0, 1700000000) // true (equal intervals)
* @example intervalEngulfsUnix(0, 1700000000, 0, 1500000000) // true
* @example intervalEngulfsUnix(1500000000, 1600000000, 0, 1700000000) // false
* @example intervalEngulfsUnix(NaN, 1700000000, 1500000000, 1600000000) // false
*/
export declare function intervalEngulfsUnix(aStart: number | string, aEnd: number | string, bStart: number | string, bEnd: number | string): boolean;