isValidInterval
Signature
Section titled “Signature”isValidInterval(interval: Interval): booleanValidate whether a value is an Interval the interval/ namespace accepts.
- True when
startandendare ISO 8601 instant strings (offset required, no leap second) andstartis not afterend. - Accepts no annotation: a time zone, a calendar or an elective one on either endpoint returns
false. The offset alone fixes the instant, and one written with seconds is read exactly. - Compares instants, not text:
{ start: "2024-01-01T10:00:00+01:00", end: "2024-01-01T09:30:00Z" }is valid even though it sorts backwards as a string. start === endis valid — an empty interval.- Use it to tell a legitimate
[]frommergeIntervals,subtractIntervalsorsplitIntervalAtapart from their invalid-input sentinel, which is also[]. - Returns
falsefor non-objects,null, and records whosestart/endare not strings.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
interval | Interval | candidate { start, end } record of ISO 8601 instant strings |
Returns
Section titled “Returns”boolean indicating whether every interval/ function accepts it
Related types
Section titled “Related types”Examples
Section titled “Examples”import { isValidInterval } from "@northguild/gmt/interval/validate";
isValidInterval({ start: "2024-01-01T09:00:00Z", end: "2024-01-01T17:00:00Z" }) // trueSource
Section titled “Source”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.