intervalEngulfsUtc
Signature
Section titled “Signature”intervalEngulfsUtc(aStart: string, aEnd: string, bStart: string, bEnd: string): booleanReturn true when the half-open interval B [bStart, bEnd) lies within the half-open interval A [aStart, aEnd) — every instant of B is also in A.
- Half-open: an interval holds every
twithstart <= t < end. B may start at A’s start and end at A’s end, because neither end is part of either interval. - B must also overlap A, so an empty B (
bStart === bEnd) counts only strictly inside A, never at an edge (CORE-6’sclampIntervalclamps it away there). - Equivalent to 4-argument
intervalContainsUtc(aStart, aEnd, bStart, bEnd). - Uses
Temporal.Instant.comparefor comparison. - Returns
falseif either interval is invalid (start > end). - Returns
falseon invalid input (wrong type, non-Zstrings, malformed strings, leap seconds).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
aStart | string | ISO 8601 UTC datetime string for the outer interval start |
aEnd | string | ISO 8601 UTC datetime string for the outer interval end (excluded) |
bStart | string | ISO 8601 UTC datetime string for the inner interval start |
bEnd | string | ISO 8601 UTC datetime string for the inner interval end (excluded) |
Returns
Section titled “Returns”true if B lies within A, or false on invalid input
Examples
Section titled “Examples”import { intervalEngulfsUtc } from "@northguild/gmt/utc/interval";
intervalEngulfsUtc("2024-01-01T09:00:00Z", "2024-01-01T17:00:00Z", "2024-01-01T12:00:00Z", "2024-01-01T13:00:00Z") // true