intervalAbutsDateTime
Signature
Section titled “Signature”intervalAbutsDateTime(aStart: string, aEnd: string, bStart: string, bEnd: string): booleanReturn true when two half-open datetime intervals [aStart, aEnd) and [bStart, bEnd) are exactly adjacent — one ends where the other starts, so they share nothing and leave no gap.
- Half-open: an interval holds every
twithstart <= t < end, so an interval’sendis the first value after it. ReturnstruewhenaEnd === bStartorbEnd === aStart(Allen’s “meets”). There is no one-nanosecond step: a one-nanosecond gap is a gap. - An empty interval (
start === end) abuts nothing. - Uses
Temporal.PlainDateTime.comparefor comparison. - Returns
falsewhen intervals overlap, are disjoint with a gap, or are invalid. - Returns
falseon invalid input (wrong type, malformed strings).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
aStart | string | ISO 8601 datetime string for the first interval start |
aEnd | string | ISO 8601 datetime string for the first interval end |
bStart | string | ISO 8601 datetime string for the second interval start |
bEnd | string | ISO 8601 datetime string for the second interval end |
Returns
Section titled “Returns”true if intervals are exactly adjacent, or false on invalid input
Examples
Section titled “Examples”import { intervalAbutsDateTime } from "@northguild/gmt/plain/interval";
intervalAbutsDateTime("2024-01-01T09:00:00", "2024-01-01T12:00:00", "2024-01-01T12:00:00", "2024-01-01T17:00:00") // true