angular / angular/components

bug(MatDatePicker): NativeDatePicker not using the correct format initially

Ouverte
#31,107 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

### 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 use the following setup:

```

provideNativeDateAdapter({
parse: {
dateInput: 'DD.MM.YYYY',
},
display: {
dateInput: 'DD.MM.YYYY',
monthYearLabel: 'MMM YYYY',
dateA11yLabel: 'LL',
monthYearA11yLabel: 'MMMM YYYY',
},
}),
{
provide: LOCALE_ID,
useValue: 'de-CH'
},
```

the DatePicker will show the date in the wrong format: "13.5.2025" instead of "13.05.2025". Why are the format options ignored?

### Reproduction

StackBlitz link:
Steps to reproduce:
1.
2.

### Expected Behavior

Date is formatted as "13.05.2025".

### Actual Behavior

Date is formatted as "13.5.2025".

### Environment

- Angular: 19.1.4
- CDK/Material: 19.1.5
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 11

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez avec NativeDatePicker et la configuration de provideNativeDateAdapter présentée dans l’issue, en utilisant la locale de-CH et le format dateInput fourni. Reproduisez l’affichage initial et recherchez pourquoi le format configuré est ignoré ; le travail est terminé lorsque le picker affiche initialement la date sous la forme "13.05.2025".

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.