@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
25 lines (24 loc) • 1.64 kB
TypeScript
/**
* Return true when interval B is fully contained within interval A — every instant of B
* falls within A.
*
* - Uses `Temporal.PlainDate.compare` for comparison.
* - Equivalent to 4-argument `intervalContainsDate(aStart, aEnd, bStart, bEnd)`.
* - Returns `false` if either interval is invalid (`start > end`).
* - Returns `false` on invalid input (wrong type, malformed strings).
* - Accepts GMT calendar-annotated PlainDate strings — E5 (issue #78). Ordering is
* calendar-independent, so arguments may carry different or no calendar tags (D4).
*
* @param aStart ISO 8601 date string for the outer interval start, optionally calendar-annotated
* @param aEnd ISO 8601 date string for the outer interval end, optionally calendar-annotated
* @param bStart ISO 8601 date string for the inner interval start, optionally calendar-annotated
* @param bEnd ISO 8601 date string for the inner interval end, optionally calendar-annotated
* @returns true if B is fully contained in A, or false on invalid input
*
* @example intervalEngulfsDate("2024-01-01", "2024-12-31", "2024-06-01", "2024-07-01") // true
* @example intervalEngulfsDate("2024-01-01", "2024-12-31", "2024-01-01", "2024-12-31") // true (equal intervals)
* @example intervalEngulfsDate("2024-01-01", "2024-12-31", "2024-06-01", "2024-12-31") // true
* @example intervalEngulfsDate("2024-06-01", "2024-07-01", "2024-01-01", "2024-12-31") // false
* @example intervalEngulfsDate("invalid", "2024-12-31", "2024-06-01", "2024-07-01") // false
*/
export declare function intervalEngulfsDate(aStart: string, aEnd: string, bStart: string, bEnd: string): boolean;