intervalEngulfsTime
Signature
Section titled “Signature”intervalEngulfsTime(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 clock time 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
intervalContainsTime(aStart, aEnd, bStart, bEnd). - PlainTime has no day rollover: an interval never wraps past midnight. And because
endis excluded, no interval contains23:59:59.999999999— containing it would need anendgreater than it, and no PlainTime is. An interval may still have it as itsend:intervalContainsTime("09:00:00", "23:59:59.999999999", "23:00:00")istrue, whileintervalContainsTime("09:00:00", "23:59:59.999999999", "23:59:59.999999999")isfalse. - Uses
Temporal.PlainTime.comparefor comparison. - Returns
falseif either interval is invalid (start > end). - Returns
falseon invalid input (wrong type, malformed strings).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
aStart | string | ISO 8601 time string for the outer interval start |
aEnd | string | ISO 8601 time string for the outer interval end (excluded) |
bStart | string | ISO 8601 time string for the inner interval start |
bEnd | string | ISO 8601 time 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 { intervalEngulfsTime } from "@northguild/gmt/plain/interval";
intervalEngulfsTime("09:00:00", "17:00:00", "12:00:00", "13:00:00") // true