Skip to content

bug(Datepicker): Not marked as dirty if first input is an invalid date #19726

@DominicSachs

Description

@DominicSachs

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/angular-ivy-8sjw5j

Steps to reproduce:
If I enter an invalid date like 'aaa' in Datepicker for the first time, then the dirty flag is not set. And then the ShowOnDirtyErrorStateMatcher does not show an error.

With the OnBlur Matcher it is working. Please comment out line 26 in app.component.ts and try it again. Enter 'aaa' and trigger onBlur while you click the tab key.

Expected Behavior

The date control is marked as dirty and the error is shown.

Actual Behavior

No error is displayed because the control is not marked as dirty.

Environment

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

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions