angular / angular/components

Allow mat-datepicker to return a string instead of a date object.

Ouverte
#16,010 15 commentaires 18 réactions 0 personnes assignées Voir sur GitHub
area: material/datepicker feature P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

#### Please describe the feature you would like to request.
Allow for the mat-datepicker to return a string, instead of a `Date` object.

#### What is the use-case or motivation for this proposal?
I am currently attempting to use mat-datepicker, with the Angular Form Builder. The only issue, is that mat-datepicker will return the selected value as a Date object instead of a string. This does not allow for the value to be immediately passed in from the mat-datepicker into a formGroup, and then sent as a request to the server without first converting it to a string. In an app that heavily uses date-picker it requires a new component to be built on top of mat-datepicker.

#### Is there anything else we should know?
The following is a [stackblitz](https://angular-material-nw1brd.stackblitz.io/), which re-iterates point that the mat-datepicker returns an object, instead of the expected string. You will have to open up console in order to see value.

If you have any recommendations on how to provide a value from a module side of things, so that mat-datepicker returns a string instead of a date object, it would be very much so appreciated. Thank you.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par le comportement de mat-datepicker montré dans le StackBlitz lié et suivez la manière dont sa valeur sélectionnée entre dans le formGroup d’Angular Form Builder. Clarifiez le format de chaîne attendu et déterminez si la modification doit être configurable avant de décider quelles exigences d’achèvement et de compatibilité s’appliquent.

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
25/100

Recevez les nouvelles issues par e-mail

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