datepicker: shows date using provided LOCALE_ID but parses date using default US locale (or a combination of them)
- Lenguaje dominante
- TypeScript
- Estrellas
- 25k
- Forks
- 6.8k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 91
Descripción
#### Bug, feature request, or proposal:
Bug. I don't think it is working like that on purpose.
#### What is the expected behavior?
Date picker uses provided en-GB LOCALE_ID for parsing typed in date - 27/10/2018 input manually by typing is valid
#### What is the current behavior?
Typed date is parsed using US locale - 27/10/2018 input manually is invalid, 12/01/2018 is December, not January.
#### What are the steps to reproduce?
https://stackblitz.com/edit/angular-datepicker-locale?file=main.ts
1. Select 27/10/2018 using date picker.
2. Modify the date by editing the input to 26/10/2018
3. Observe invalid input
#### What is the use-case or motivation for changing an existing behavior?
Make material datepicker great again! But seriously: it seems like if a culture is provided it should affect both parsing and formatting aspects of dealing with dates and not format it into a date which is considered invalid when updated by typing.
#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
As in demo: Angular 7.1.0 Material 7.1.0. It fails validation on chrome if day (month?) is over 12, but on IE 11 is more curious as it modifies the year, I am fairly sure the swap issue causes it to work incorrectly on any browser.
#### Is there anything else we should know?
I think it may have been an issue with parsing the text date from text - it seems like it would parse using US culture ignoring provided locale.
Guía de contribución
Línea de trabajo
Empieza con el StackBlitz enlazado y su main.ts, reproduciendo el comportamiento del datepicker en-GB al seleccionar y después editar una fecha. Rastrea cómo el datepicker formatea y analiza la entrada escrita, y verifica después que fechas como 27/10/2018 se acepten de forma coherente con el locale proporcionado y que la reproducción existente ya no falle la validación.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, typescript
- Área
- frontend, internationalization
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100