Skip to content

intervalAbutsDateTime

  • The core functions, which every industry uses.
intervalAbutsDateTime(aStart: string, aEnd: string, bStart: string, bEnd: string): boolean

Return 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 t with start <= t < end, so an interval’s end is the first value after it. Returns true when aEnd === bStart or bEnd === 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.compare for comparison.
  • Returns false when intervals overlap, are disjoint with a gap, or are invalid.
  • Returns false on invalid input (wrong type, malformed strings).
ParameterTypeDescription
aStartstringISO 8601 datetime string for the first interval start
aEndstringISO 8601 datetime string for the first interval end
bStartstringISO 8601 datetime string for the second interval start
bEndstringISO 8601 datetime string for the second interval end

true if intervals are exactly adjacent, or false on invalid input

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
output 

plain/interval/intervalAbutsDateTime.ts

Accessibility
© 2026 NorthGuild · Licences

Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.