predictype / predicates/dates / dateRange
dateRange(
source
,oper
,min
,max
):boolean
Defined in: predicates/dates/dateRange.ts:38
Checks if a date is in or outside a UTC date range using the specified operation.
Date
The date to check.
The range operation to perform (e.g. ‘in_range’, ‘strict_in_range’).
Date
The minimum date (inclusive or exclusive depending on operation).
Date
The maximum date (inclusive or exclusive depending on operation).
boolean
True if the range check is valid according to the operator, otherwise false.
If the operation is not recognized.
const date = new Date('2025-01-10');
const start = new Date('2025-01-01');
const end = new Date('2025-01-31');
dateRange(date, 'in_range', start, end); // true
Supported Operators: