Skip to content

MtxDatetimePicker not populated when the recieved date is as string #235

@vmuresanu

Description

@vmuresanu

Description:
When receiving date as iso string, date picker value is not populated. One real scenario is that all dates from BE are as string.

Expected:
Date is being populated

Reproduction:
https://stackblitz.com/edit/stackblitz-starters-u7c3h8?description=An%20angular-cli%20project%20based%20on%20@angular/animations,%20@angular/common,%20@angular/compiler,%20@angular/core,%20@angular/forms,%20@angular/platform-browser,%20@angular/platform-browser-dynamic,%20@angular/router,%20core-js,%20rxjs,%20tslib%20and%20zone.js&file=src%2Fmain.ts,src%2Fmain.html,angular.json,src%2Fglobal_styles.scss&title=Angular%20Starter

Note: There are two components in the stackblitz example, one of them is the Datepicker from Angular Material, and notice that the control value is populated both as string and as Date. However if we change the formControl value to:
control = new FormControl(new Date('2023-04-08T18:51:00.000Z')); both pickers are populated

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions