Change datepicker parse and display format at runtime
- Langage dominant
- TypeScript
- Étoiles
- 25k
- Forks
- 6.8k
- Merge moyen
- 1 j 8 h
- PR mergées (30 j)
- 91
Description
#### Bug, feature request, or proposal:
Currently the parse and display format of a datepicker can only be set before runtime by providing them with ```provide: MAT_DATE_FORMATS, useValue: MY_DATE_FORMATS```.
As shown in the example: https://material.angular.io/components/datepicker/examples
#### What is the expected behavior?
The parse and display format of the datepicker should also be able to be changed at runtime, the same way it's possible to change the locale at runtime with ```.setLocale()```.
Maybe add ```.setDateFormat(MY_DATE_FORMAT_GENERATED_AT_RUNTIME)```, as sometimes the date format is only available after a HTTP request to the server.
#### What is the current behavior?
Date format is set in provider and cannot be changed at runtime.
#### What is the use-case or motivation for changing an existing behavior?
It should be possible to change the date format at runtime, to be able to react to date-formats, set by the backend. The user can set a preferred date format in the application and the application has to retrieve it from the server and adjust the datepicker accordingly. This is currently not possible.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par les exemples de datepicker d’Angular Material et le fournisseur MAT_DATE_FORMATS présenté dans l’issue, puis suivez la manière dont setLocale() modifie le comportement du datepicker. Définissez et vérifiez un mécanisme à l’exécution permettant de mettre à jour les formats d’analyse et d’affichage après une réponse du serveur, y compris le comportement attendu lorsque le format change.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- angular, typescript
- Domaine
- frontend
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 42/100