Hi guys!
I encountered a very strange behavior by the DatePickerComponent because as I discovered, the component's min field isn't resetting properly upon the OnDestroy lifecycle.
Reproduction code: https://stackblitz.com/edit/angular-22wree
Reproduction steps:
- Set the first date to 2018.10.10.
- Set the second date to 2018.10.10.
- Set the first date to 2018.10.15.
- Modify the second date (to trigger the minError validation) to 2018.10.14.
- Now press the Reset button twice.
And here comes the bug. If you set the first date to 2018.10.05 and the second date to 2018.10.06, the second date triggers the minError validation error with the first min date and not with the actual date.
These dates are just examples for a fast reproduction but in short you need to trigger the minError validation twice on the second date field: First just normally, and the second must occur after the show/hide mechanism.
I didn't test this for the max field.