angular / angular/components

valid dd/mm format switch sides after manual input on datepicker field

Aperta
#11,936 18 commenti 11 reazioni 0 assegnatari Vedi su GitHub
area: material/datepicker P4
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

#### Bug, feature request, or proposal:
Bug

#### What is the expected behavior?
That the valid `dd/mm/yyyy` inputed date remains as it is, not matter what, they always switch sides on change.

#### What is the current behavior?
E.g.: `03/02/1990` becomes `02/03/1990`.

#### What are the steps to reproduce?
Set a custom locale like Brasil:

```typescript
// location
import localePt from '@angular/common/locales/pt';
import localePtExtra from '@angular/common/locales/extra/pt';

registerLocaleData(localePt, 'pt', localePtExtra);
```

Then try to use the datepicker with manual input.

#### What is the use-case or motivation for changing an existing behavior?
Because it works very well with the Angular locale config, there's just this switch bug that does not work properly.

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
```json
{
"@angular/core": "^6.0.6",
"@angular/material": "^6.3.0",
}
```

#### Is there anything else we should know?

##### UI input:

![image](https://user-images.githubusercontent.com/3942006/41925531-3ab16044-7943-11e8-884c-3b591f537b8e.png)

##### Manual input:
![image](https://user-images.githubusercontent.com/3942006/41925561-4f8d566c-7943-11e8-8a73-e2d76a0659b1.png)

~I really don't wanna use moment.js~

----

It seems like the StackBlitz example isn't wroking as well: https://stackblitz.com/angular/vnvbdjykmve?file=app%2Fdatepicker-locale-example.ts

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con l'esempio StackBlitz collegato in app/datepicker-locale-example.ts e riproduci il comportamento di input manuale del datepicker dopo aver registrato la locale pt e i dati di locale aggiuntivi. Traccia il parsing consapevole della locale del datepicker e la gestione delle modifiche; il lavoro è completato quando un valore inserito come 03/02/1990 rimane invariato dopo la modifica del campo.

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

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend, internationalization
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 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.