Skip to content

bug(Timepicker): valueChanges-event is called during initialization #32423

@awallat

Description

@awallat

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

When I register to the valueChanges of a form-group, then I get a valueChange during initialization, which is different from other components. I prepared a StackBlitz for this where I have datepicker and a timepicker. Only when the timepicker is present, the form emits a valueChanges-event.

Reproduction

StackBlitz link: https://stackblitz.com/edit/iar2r8q6?file=src%2Fexample%2Ftimepicker-overview-example.html,src%2Fexample%2Ftimepicker-overview-example.ts&startScript=start
Steps to reproduce:

  1. Open the developer console and watch for the logs
  2. In the beginning there is no component in the form.
  3. After 500ms the datepicker is added and no valueChanges-event is emitted.
  4. after another 500ms the timepicker is added, but here a valueChanges-event is emitted.

This behavior is not consistent in my opinion.

Expected Behavior

The timepicker should not send a valueChanges-event during initialization.

Actual Behavior

The timepicker sends a valueChanges-event during initialization.

Environment

  • Angular: 21.0.0
  • CDK/Material: 21.0.0
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS, Windows

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