Skip to content

isBetweenDate

  • The core functions, which every industry uses.
isBetweenDate(date: string, start: string, end: string, options?: { inclusiveStart?: boolean; inclusiveEnd?: boolean; }): boolean

Return true when date is between start and end (inclusive by default).

  • Uses Temporal.PlainDate.compare to compare dates.
  • Returns false if start > end (invalid range).
  • Returns false if any input is invalid.
ParameterTypeDescription
datestringISO PlainDate string to check
startstringISO PlainDate string for the start of the range
endstringISO PlainDate string for the end of the range

options

Whether each end of the range counts as inside it

OptionTypeDefaultDescription
inclusiveStart?booleantrueWhether date equal to start counts as inside the range. false requires it to be after start.
inclusiveEnd?booleantrueWhether date equal to end counts as inside the range. false requires it to be before end.

boolean indicating whether date is between start and end

import { isBetweenDate } from "@northguild/gmt/plain/compare";
isBetweenDate("2024-02-29", "2024-02-01", "2024-02-28") // false
output 

plain/compare/isBetweenDate.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.