isDateConstraint()
isDateConstraint(
schema):schema is DateConstraint
Type guard for DateConstraint. Checks that the schema is a date type and has constraint methods.
Parameters
schema: GenericSchema
The schema to check
Returns: schema is DateConstraint
True if the schema is a DateConstraint with constraint methods
Since
2.0.0
Example
const schema = date().min(new Date('2020-01-01'));
if (isDateConstraint(schema)) {
// schema is narrowed to DateConstraint
schema.max(new Date('2030-01-01')); // constraint methods available
}