intervalAbutsDateTime
Signature
Section titled “Signature”intervalAbutsDateTime(aStart: string, aEnd: string, bStart: string, bEnd: string): booleanimport { intervalAbutsDateTime } from "@northguild/gmt/plain/interval";Return true when two datetime intervals are exactly adjacent — one’s end equals the other’s
- start with zero gap and zero overlap.
- Uses
Temporal.PlainDateTime.comparefor comparison. - Returns
truewhenaEnd + 1 nanosecond === bStartorbEnd + 1 nanosecond === aStart. - 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”intervalAbutsDateTime("2024-01-01T09:00:00", "2024-06-30T12:00:00", "2024-06-30T12:00:00.000000001", "2024-12-31T17:00:00") // trueintervalAbutsDateTime("2024-06-30T12:00:00", "2024-12-31T17:00:00", "2024-01-01T09:00:00", "2024-06-30T12:00:00.000000001") // trueintervalAbutsDateTime("2024-01-01T09:00:00", "2024-06-30T12:00:00", "2024-06-30T12:00:01", "2024-12-31T17:00:00") // false (gap)intervalAbutsDateTime("2024-01-01T09:00:00", "2024-06-30T13:00:00", "2024-06-30T12:00:00", "2024-12-31T17:00:00") // false (overlap)intervalAbutsDateTime("invalid", "2024-06-30T12:00:00", "2024-06-30T12:00:00", "2024-12-31T17:00:00") // false