ngl-datepicker-input "relativeYearTo" and "relativeYearFrom" should affect underlying FormControl Validator
bran22 opened this issue · comments
Summary
Hi, I noticed a bug with the relativeYearTo
and relativeYearFrom
inputs when used with the ngl-datepicker-input
. It doesn't seem like these configuration options are applied to the underlying FormControl Validator in the way the min
and max
options do. This means that although the calendar prevents users from selecting a date outside the relative range, users are still able to type in a date outside the range and the Validator believes this is Valid. Can this be changed to mark the field as "Invalid" in the same way that min
and max
do?
Environment
- Observed in Angular9 locally, reproduced in Angular11 at Stackblitz link below
- ng-lightning@7.0.1
- Chrome 88
Steps to reproduce:
See this stackblitz example: https://stackblitz.com/edit/angular-fhwnvr-swedkd?file=src/app/input.html
- Instantiate a
ngl-datepicker-input
that sets a minimum date usingmin
, and sets a maximum date usingrelativeYearTo
- Use the input box to type in a date less than the minimum date
- Log out
model.valid
and observe it isfalse
- This is expected behavior - Use the input box to type in a date greater than the maximum date
- Log out
model.valid
and observe it istrue
- This unexpected, I expected it to be false as well