intervalsOverlapTime
Signature
Section titled “Signature”intervalsOverlapTime(aStart: string, aEnd: string, bStart: string, bEnd: string): booleanReturn true when the half-open time intervals [aStart, aEnd) and [bStart, bEnd) share at least one clock time.
- Half-open: an interval holds every
twithstart <= t < end, soenditself is not in it (the rule CORE-6’sintervalsOverlapuses). The test isaStart < bEnd && bStart < aEnd. - Touching intervals (
aEndequal tobStart) share no time and do not overlap. - An empty interval (
start === end) overlaps only an interval it lies strictly inside. - PlainTime has no day rollover: an interval never wraps past midnight.
- 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 first interval start |
aEnd | string | ISO 8601 time string for the first interval end (excluded) |
bStart | string | ISO 8601 time string for the second interval start |
bEnd | string | ISO 8601 time string for the second interval end (excluded) |
Returns
Section titled “Returns”true if intervals overlap, or false on invalid input
Examples
Section titled “Examples”import { intervalsOverlapTime } from "@northguild/gmt/plain/interval";
intervalsOverlapTime("09:00:00", "17:00:00", "12:00:00", "18:00:00") // true