You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
This is due to the default date adapter. From the docs:
Please note: provideNativeDateAdapter is based off the functionality available in JavaScript's native Date object. Thus it is not suitable for many locales. One of the biggest shortcomings of the native Date object is the inability to set the parse format. We strongly recommend using an adapter based on a more robust formatting and parsing library. You can use provideMomentDateAdapter or a custom DateAdapter that works with the library of your choice.
MatDatepicker seems to not accept dates in
dd/mm/yyyy
format, even when theMAT_DATE_LOCALE
andDateAdapter
'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:
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
The text was updated successfully, but these errors were encountered: