import { CommonValidatorBuilderImpl , DateValidatorBuilder , ValidationOptionsBuilder } from "./" ; import { ValidationRule } from "../validation" ; import { PropertyValidator } from "../validators/PropertyValidator" ; import { IsAfterValidator , IsBeforeValidator , IsBetweenValidator , IsSameAsValidator , IsSameOrAfterValidator , IsSameOrBeforeValidator } from "../validators/date-based" ; export class DateValidatorBuilderImpl < T > extends CommonValidatorBuilderImpl < T , Date > implements DateValidatorBuilder < T > { constructor ( validationRule ) { super ( validationRule ) ; } private buildRuleWith ( validator ) { this . validationRule . addValidator ( validator ) ; return this ; } isBefore ( date ) { return this . buildRuleWith ( new IsBeforeValidator ( date ) ) ; } isSameAs ( date ) { return this . buildRuleWith ( new IsSameAsValidator ( date ) ) ; } isAfter ( date ) { return this . buildRuleWith ( new IsAfterValidator ( date ) ) ; } isSameOrBefore ( date ) { return this . buildRuleWith ( new IsSameOrBeforeValidator ( date ) ) ; } isSameOrAfter ( date ) { return this . buildRuleWith ( new IsSameOrAfterValidator ( date ) ) ; } isBetween ( date1 , date2 , lowerBoundary = "(" , upperBoundary = ")" ) { return this . buildRuleWith ( new IsBetweenValidator ( date1 , date2 , lowerBoundary , upperBoundary ) ) ; } }