isBetweenDate
Signature
Section titled “Signature”isBetweenDate(date: string, start: string, end: string, options?: { inclusiveStart?: boolean; inclusiveEnd?: boolean; }): booleanReturn 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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
date | string | ISO PlainDate string to check |
start | string | ISO PlainDate string for the start of the range |
end | string | ISO PlainDate string for the end of the range |
Options
Section titled “Options”options
Whether each end of the range counts as inside it
| Option | Type | Default | Description |
|---|---|---|---|
inclusiveStart? | boolean | true | Whether date equal to start counts as inside the range. false requires it to be after start. |
inclusiveEnd? | boolean | true | Whether date equal to end counts as inside the range. false requires it to be before end. |
Returns
Section titled “Returns”boolean indicating whether date is between start and end
Examples
Section titled “Examples”import { isBetweenDate } from "@northguild/gmt/plain/compare";
isBetweenDate("2024-02-29", "2024-02-01", "2024-02-28") // false