angular / angular/components

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

Aperta
#31,107 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

### 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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con NativeDatePicker e la configurazione di provideNativeDateAdapter mostrata nell’issue, usando la locale de-CH e il formato dateInput fornito. Riproduci la visualizzazione iniziale e verifica perché il formato configurato viene ignorato; il lavoro è completo quando il picker visualizza inizialmente la data come "13.05.2025".

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.