-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
MatTimePicker fire events before the formControl value is updated. This is incoherent with the pre-existing behavior of MatDatePicker (and possibly other components ?). And that makes it very tricky to react to the events and manipulate the form directly.
This may be somewhat similar/related to #30223.
Reproduction
StackBlitz link: https://stackblitz.com/edit/z95dwlz7?file=src%2Fexample%2Ftimepicker-datepicker-integration-example.ts
Steps to reproduce:
- Open the console
- Select a date
- See that values from
(dateChange)
event and from the form control are equals - Select a time
- See that the value from the form control is incorrect because it was not yet changed when
(selected)
or(valueChange)
were fired
Expected Behavior
I expect MatTimePicker behavior to be consistent with MatDatePicker and set formControl value before firing events. So we can easily grab the form value (possibly including other values from other controls) and do something with that.
Actual Behavior
When the event is fired, the value from form control is not changed. If reading that value, then inconsistent behavior may be introduced.
Environment
- Angular: 20.2.5
- CDK/Material: 20.2.5
- Browser(s): Chrome