-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
MatDatepicker seems to not accept dates in dd/mm/yyyy format, even when the MAT_DATE_LOCALE and DateAdapter's locale are set to a language/locale where this format is the standard.
I have noticed that this problem can be circumvented with the MomentJS date adapter for Angular, but it shouldn't be required since it's expected behaviour.
Reproduction
StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-4gjjc1ce?file=src%2Fapp%2Fapp.component.ts
Steps to reproduce:
- Select pt-PT or fr-FR
- Type "15/12/2024" in the datepicker and hit tab
- Now type "12/15/2024" and hit tab
Expected Behavior
In step 2, the datepicker should consider that a valid date
In step 3, the datepicker should not consider that a valid date
Actual Behavior
In step 2, the datepicker considers the date invalid
In step 3, the datepicker changes the string to 15/12/2024, making it become valid
Environment
Angular CLI: 19.2.7
CDK/Material:19.2.9
Node: 20.19.0
Package Manager: pnpm 8.15.6
OS: linux x64