isBetween
isBetween(
date: Date,
start: Date,
end: Date,
inclusive: boolean,
): booleanSource: date.ts:391
Checks if a date is between two other dates
Parameters
date(Date) — Date to checkstart(Date) — Start of rangeend(Date) — End of rangeinclusive(boolean, default: "true") — Whether to include boundaries
Returns
boolean— True if date is in range
Example
CODE
const date = new Date('2024-03-15')
const start = new Date('2024-03-01')
const end = new Date('2024-03-31')
isBetween(date, start, end) // true