predictype
Version:
PredicType is a library of pre-built and tested predicates for TypeScript, covering various data types and operations.
24 lines (23 loc) • 813 B
TypeScript
import { DateStateOper } from '../../enums/dates.js';
/**
* Checks the state of a date (valid or invalid) in UTC using the specified operation.
*
* @param source The date to check.
* @param oper The state operation to perform (e.g. 'is_valid', 'is_invalid').
* @returns True if the state check is valid according to the operator, otherwise false.
*
* @throws {Error} If the operation is not recognized.
*
* @example
* const validDate = new Date('2025-01-01');
* const invalidDate = new Date('invalid');
*
* dateState(validDate, 'is_valid'); // true
* dateState(invalidDate, 'is_invalid'); // true
*
* @remarks
* Supported Operators:
* - **IS_VALID**: Is the date valid?
* - **IS_INVALID**: Is the date invalid?
*/
export declare function dateState(source: Date, oper: DateStateOper): boolean;