Skip to content

bug(timepicker): timepicker fire events before updating formControl value #31950

@PowerKiKi

Description

@PowerKiKi

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:

  1. Open the console
  2. Select a date
  3. See that values from (dateChange) event and from the form control are equals
  4. Select a time
  5. 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

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/timepicker

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions