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

Abierto
#27,412 8 comentarios 0 reacciones 0 asignados Ver en GitHub
area: material/datepicker help wanted P3
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comience con la demo de Angular Material datepicker en material.angular.io y reproduzca que la entrada YYYY-MM-DD pierde el foco en los modos predeterminado y de rango de fechas. Rastree la ruta de análisis y formateo de la entrada del datepicker y, después, verifique que 2023-07-06 se muestra como 7/6/2023 en lugar de 7/5/2023 sin cambiar el valor de fecha subyacente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
58/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.