intervalEngulfsZoned
Signature
Section titled “Signature”intervalEngulfsZoned(aStart: string, aEnd: string, bStart: string, bEnd: string): booleanimport { intervalEngulfsZoned } from "@northguild/gmt/zoned/interval";Return true when interval B is fully contained within interval A — every instant of B
- falls within A.
- Uses
Temporal.Instant.comparefor comparison (via.toInstant()). - Equivalent to 4-argument
intervalContainsZoned(aStart, aEnd, bStart, bEnd). - Returns
falseif either interval is invalid (start > end). - Returns
falseon invalid input (wrong type, malformed strings, leap seconds). - Accepts mixed calendar systems (E7’s D4-zoned, issue #152): both bare ISO zoned strings and GMT calendar-annotated ones (
"5784-06-15T14:30:00-05:00[u-ca=hebrew][America/New_York]"), and the two endpoints need not agree on a calendar. Ordering is calendar-independent — verified thatTemporal.Instantcarries no calendar field at all and thatInstant.compare/ZonedDateTime.compareboth return0for the same instant expressed in hebrew, islamic-civil, japanese and iso8601. - Still rejects Temporal’s own
[timeZone][u-ca=...]RFC 9557 ordering, which reads GMT’s calendar-native digits as ISO digits — seeregex/calendar-zoned-date-time.ts.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
aStart |
string |
ISO 8601 zoned datetime string for the outer interval start |
aEnd |
string |
ISO 8601 zoned datetime string for the outer interval end |
bStart |
string |
ISO 8601 zoned datetime string for the inner interval start |
bEnd |
string |
ISO 8601 zoned datetime string for the inner interval end |
Returns
Section titled “Returns”true if B is fully contained in A, or false on invalid input
Examples
Section titled “Examples”intervalEngulfsZoned("2024-01-01T09:00:00+00:00[UTC]", "2024-12-31T17:00:00+00:00[UTC]", "2024-06-01T12:00:00+00:00[UTC]", "2024-07-01T13:00:00+00:00[UTC]") // trueintervalEngulfsZoned("2024-01-01T09:00:00+00:00[UTC]", "2024-12-31T17:00:00+00:00[UTC]", "2024-01-01T09:00:00+00:00[UTC]", "2024-12-31T17:00:00+00:00[UTC]") // true (equal intervals)intervalEngulfsZoned("2024-01-01T09:00:00+00:00[UTC]", "2024-12-31T17:00:00+00:00[UTC]", "2024-01-01T09:00:00+00:00[UTC]", "2024-06-30T12:00:00+00:00[UTC]") // trueintervalEngulfsZoned("2024-06-01T12:00:00+00:00[UTC]", "2024-07-01T13:00:00+00:00[UTC]", "2024-01-01T09:00:00+00:00[UTC]", "2024-12-31T17:00:00+00:00[UTC]") // falseintervalEngulfsZoned("invalid", "2024-12-31T17:00:00+00:00[UTC]", "2024-06-01T12:00:00+00:00[UTC]", "2024-07-01T13:00:00+00:00[UTC]") // false