isValidDateRange
Signature
Section titled “Signature”isValidDateRange(props: IsValidDateRangeProps): booleanReturn whether value1 is before value2.
- Validates both dates with
isValidDate, so an annotation of any kind on either endpoint ([foo=bar],[u-ca=iso8601], a time zone) returnsfalse. - Rejects leap seconds in either date.
Options
Section titled “Options”props
The two values to compare and how equal values are treated
The argument object of isValidDateRange.
import type { IsValidDateRangeProps } from "@northguild/gmt";| Option | Type | Default | Description |
|---|---|---|---|
value1 | string | Required | The start of the range, an ISO PlainDate string. |
value2 | string | Required | The end of the range, an ISO PlainDate string. |
options? | object | None. Equal values are not a valid range. | The settings for the comparison. It must be an object or omitted; any other value, null included, returns false. |
options.allowEqual? | boolean | false | Whether value1 equal to value2 is a valid range. false requires value1 to be before value2. |
Returns
Section titled “Returns”boolean indicating whether the date range is valid
Examples
Section titled “Examples”import { isValidDateRange } from "@northguild/gmt/plain/validate";
isValidDateRange({ value1: "2024-02-28", value2: "2024-02-29" }) // 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.