intervalAbutsDate
Signature
Section titled “Signature”intervalAbutsDate(aStart: string, aEnd: string, bStart: string, bEnd: string): booleanReturn true when two half-open date 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-day step: a one-day gap is a gap. - An empty interval (
start === end) abuts nothing. - Uses
Temporal.PlainDate.comparefor comparison. - Returns
falsewhen intervals overlap, are disjoint with a gap, or are invalid. - Returns
falseon invalid input (wrong type, malformed strings). - Accepts RFC 9557 calendar-annotated PlainDate strings (as produced by
convertDateToCalendar) — E5 (issue #78). Comparison is by calendar-independent ordering (Temporal.PlainDate.compareignores calendar), so the four endpoints may carry different or no calendar tags — E5 decision of record D4 (ordering-only functions accept mixed calendars). - Compatibility: since 1.16.0 calendar strings are RFC 9557 (ISO digits,
[u-ca=<id>], canonical calendar ids); seeisValidCalendarDate.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
aStart | string | ISO 8601 date string for the first interval start, optionally calendar-annotated |
aEnd | string | ISO 8601 date string for the first interval end, optionally calendar-annotated |
bStart | string | ISO 8601 date string for the second interval start, optionally calendar-annotated |
bEnd | string | ISO 8601 date string for the second interval end, optionally calendar-annotated |
Returns
Section titled “Returns”true if intervals are exactly adjacent, or false on invalid input
Examples
Section titled “Examples”import { intervalAbutsDate } from "@northguild/gmt/plain/interval";
intervalAbutsDate("2024-01-01", "2024-06-30", "2024-06-30", "2024-12-31") // true