angular / angular/components

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

Offen
#16,010 15 Kommentare 18 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/datepicker feature P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit dem im verknüpften StackBlitz gezeigten Verhalten von mat-datepicker und verfolgen Sie, wie sein ausgewählter Wert in die formGroup von Angular Form Builder gelangt. Klären Sie das erwartete Zeichenfolgenformat und ob die Änderung konfigurierbar sein sollte, bevor Sie entscheiden, welche Anforderungen an Vollständigkeit und Kompatibilität gelten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.