Custom validator on 3 separate dates

86 Views Asked by At

I wrote a dynamic form that triggers three dates if the user clicks any of the checkboxes (the logic here isn't important.. clicking any of the checkboxes would show the dates). The issue is trying to write the right amount or the right type of custom validation that would make sure the three dates follow the correct order.

First date should be before second date and second date should be before third date. Also... changing any of the three dates should trigger the validator. I wrote a "beforeDatevalidator" that can track if the second date is before the first date or if the third date is before the second date when the user selects them. The issue is... the custom validator doesn't trigger when i select the first date (in trying to correct the second date being before the first date)

I created a stackblitz with the code so far... I'm also open to adifferent solution if this isn't the best direction.

https://stackblitz.com/edit/angular-empty-project-qzjttt?file=app/app.component.ts

0

There are 0 best solutions below