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
}