@ticatec/web-bean-validator
Version:
A TypeScript/JavaScript library for rule-based entity validation with boundary checking for strings, numbers, dates, enums, objects, and arrays.
18 lines (17 loc) • 639 B
TypeScript
import BaseValidator, { ValidatorOptions } from "./BaseValidator";
import type ValidationResult from "./ValidationResult";
export interface DateValidatorOptions extends ValidatorOptions {
from?: Date;
to?: Date;
maxDaysBefore?: number;
maxDaysAfter?: number;
}
export default class DateValidator extends BaseValidator {
protected from: Date;
protected to: Date;
protected maxDaysBefore: number;
protected maxDaysAfter: number;
constructor(field: string, options: DateValidatorOptions);
protected checkField(value: any, result: ValidationResult): boolean;
protected checkType(value: any): any;
}