Open alixroyere opened 4 months ago
Can you share what your code looks like?
Here is a reproduction link: https://stackblitz.com/edit/stackblitz-starters-xhx4k1?file=src%2Fmain.ts There is a custom validator on group, which validates that there is a maximum of 10 days between start and end dates => Input doesn't become invalid (and so no mat-error displayed).
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Hello,
https://material.angular.io/components/datepicker/overview#date-range-input-forms-integration The mat date range input documentation states:
So I'm expecting the form group, grouping start and end date, to update the "global range input" state, but this is not the case.
My use case is to add a customValidator (to limit the number of days between start and end dates) on the formGroup. When the form is in error, I was expecting the form field to be red and to display mat-error, but nothing shows when the form is invalid.
I've found a workaround using ErrorStateMatcher. But it feels like it's supposed to be included in mat date range picker as both inputs are inside, within the formGroup https://material.angular.io/components/input/overview#changing-when-error-messages-are-shown
Reproduction
Have mat date range picker with a form group validator => only start and end controls are updating displayed form field validity
Reproduction link: https://stackblitz.com/edit/stackblitz-starters-xhx4k1?file=src%2Fmain.ts
Expected Behavior
When formGroup is in error, form field state should be in error and display mat-error
Actual Behavior
When formGroup is in error, form field state is valid and no mat-error is displayed
Environment