@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
23 lines (22 loc) • 1.31 kB
TypeScript
/**
* Return true when interval B is fully contained within interval A — every instant of B
* falls within A.
*
* - Uses `Temporal.PlainTime.compare` for comparison.
* - Equivalent to 4-argument `intervalContainsTime(aStart, aEnd, bStart, bEnd)`.
* - Returns `false` if either interval is invalid (`start > end`).
* - Returns `false` on invalid input (wrong type, malformed strings).
*
* @param aStart ISO 8601 time string for the outer interval start
* @param aEnd ISO 8601 time string for the outer interval end
* @param bStart ISO 8601 time string for the inner interval start
* @param bEnd ISO 8601 time string for the inner interval end
* @returns true if B is fully contained in A, or false on invalid input
*
* @example intervalEngulfsTime("09:00:00", "17:00:00", "12:00:00", "13:00:00") // true
* @example intervalEngulfsTime("09:00:00", "17:00:00", "09:00:00", "17:00:00") // true (equal intervals)
* @example intervalEngulfsTime("09:00:00", "17:00:00", "09:00:00", "12:00:00") // true
* @example intervalEngulfsTime("12:00:00", "13:00:00", "09:00:00", "17:00:00") // false
* @example intervalEngulfsTime("invalid", "17:00:00", "12:00:00", "13:00:00") // false
*/
export declare function intervalEngulfsTime(aStart: string, aEnd: string, bStart: string, bEnd: string): boolean;