If you mark the input for the Daterangepicker as required in your HTML, then type some random text and press Tab to move to the next input, Daterangepicker will remove that "bad" text (as expected), but the input itself will still be valid (ng-valid class gets injected by Angular).
Initial state:

Invalid text entered:

After control looses focus:

Hi,
I am unable to validate using custom validator on datepicker while entering junk data it returns Invalid Date.
For Blank input field validation is working fine as shown in figure
But when i am entering character or junk data it returns Invalid date but i am unable to apply angular validation. Please help
HTML Code for This
TS file code
this.rrfForm.get('rrf_temp_tenure_from_date').setValidators([Validators.required, ValidationService.dateValidator]);
Service function
static dateValidator(control) {
if (control.value.match(/^(0[1-9]|1\d|2\d|3[01]).(0[1-9]|1[0-2]).(19|20)\d{2}$/)) {
return null;
} else {
return { 'invalidPassword': true };
}
}
Getting Error on Console :

Added
@valorkin what is the solution could you please explain?
Most helpful comment
@valorkin what is the solution could you please explain?