Skip to content

isValidDateRange

  • The core functions, which every industry uses.
isValidDateRange(props: IsValidDateRangeProps): boolean

Return 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) returns false.
  • Rejects leap seconds in either date.

props

The two values to compare and how equal values are treated

The argument object of isValidDateRange.

import type { IsValidDateRangeProps } from "@northguild/gmt";
OptionTypeDefaultDescription
value1stringRequiredThe start of the range, an ISO PlainDate string.
value2stringRequiredThe end of the range, an ISO PlainDate string.
options?objectNone. 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?booleanfalseWhether value1 equal to value2 is a valid range. false requires value1 to be before value2.

boolean indicating whether the date range is valid

import { isValidDateRange } from "@northguild/gmt/plain/validate";
isValidDateRange({ value1: "2024-02-28", value2: "2024-02-29" }) // true
output 

plain/validate/isValidDateRange.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.