predictype / predicates/dates/dateState / dateState
dateState(
source
,oper
):boolean
Defined in: predicates/dates/dateState.ts:34
Checks the state of a date (valid or invalid) in UTC using the specified operation.
Date
The date to check.
The state operation to perform (e.g. ‘is_valid’, ‘is_invalid’).
boolean
True if the state check is valid according to the operator, otherwise false.
If the operation is not recognized.
const validDate = new Date('2025-01-01');
const invalidDate = new Date('invalid');
dateState(validDate, 'is_valid'); // true
dateState(invalidDate, 'is_invalid'); // true
Supported Operators: