Skip to content

bug(DatePicker): Mat Datepicker is firing matDatepickerFilter with a null value in 12.2.13 but in 9.2.0 it doesn't. #24728

@MathewBerg

Description

@MathewBerg

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

9.2.0

Description

Adding a matDatepickerFilter onto a datepicker in 12.2.13 has the filter execute immediately along with a null value. I have not done a deep dive to see which version introduced this, we went from 9.x to 12.x and only noticed it when our testers raised a different issue.

Reproduction

  1. Create a mat datepicker component
  2. Wire up a simple matDatepickerFilter with a console.log

12.2.13 with the extra log:
https://stackblitz.com/edit/angular-11-material-reactive-starter-mfw6fz?file=src%2Fapp%2Fapp.component.ts

9.2.0 without the extra log:
https://stackblitz.com/edit/angular-9-expression-changed-issue-8rykpo?file=src%2Fapp%2Fapp.component.ts

Expected Behavior

It shouldn't be firing since the datepicker has not been opened.

Actual Behavior

It fires, and with a value of null.

Environment

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/datepicker

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions