angular / angular/components

bug(DatePicker): Typing a date in "YYYY-MM-DD" format will format the date to "M/D/YYYY" but a day behind

Ouverte
#27,412 8 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area: material/datepicker help wanted 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

Typing a date in "YYYY-MM-DD" format will format the date to "M/D/YYYY" but a day behind. This occurs using the control in various modes, including the date range picker.

### Reproduction

Steps to reproduce (can use demo on documentation page):
1. Render date picker with default formatting.
2. Type in the value "2023-07-06"
3. Lose focus of the input field.
4. The date picker changes the value to: "7/5/2023"

### Expected Behavior

I expect to see the date represented in a different format with the same date value.

Value entered: 2023-07-06
Expected result: 7/6/2023

### Actual Behavior

The date in the proper format, but one day behind.

Value entered: 2023-07-06
Actual result: 7/5/2023

### Environment

This bug occurs on the demo page for angular material:
https://material.angular.io/components/datepicker/overview

- Angular: v14+
- CDK/Material: v14+ (probably earlier)
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez avec la démonstration de Angular Material datepicker sur material.angular.io et reproduisez la perte de focus de l’entrée YYYY-MM-DD dans les modes par défaut et de plage de dates. Suivez le chemin d’analyse et de formatage de l’entrée du datepicker, puis vérifiez que 2023-07-06 s’affiche comme 7/6/2023 plutôt que comme 7/5/2023 sans modifier la valeur de date sous-jacente.

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é
Calme
Clarté
Clairement spécifiée
Accessibilité débutants
58/100

Recevez les nouvelles issues par e-mail

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