#matInput type required format yyyy-MM-dd

1 messages · Page 1 of 1 (latest)

ivory cradle
#

The error says it all. The value that a date input field expects is a date in the ISO format: yyyy-MM-dd.

fallen egret
ivory cradle
#

The problem is with the value of the form control. Not with the HTML. TRhat value needs to be in the correct, ISO format. Where do you get that value from?

fallen egret
#

Would I have to make a pipe in this case? How would I inject this information into the one I'm using mat-dialog-data?

fallen egret
ivory cradle
#

No. You need to provide the value of the form control in the right format. A pipe is used to format data in the template. Not the right tool. Where do you get that specific value from? Why is it not in a standard format in the first place?

#

OK, but where does this data come from?

fallen egret
fallen egret
ivory cradle
#

If you store dates in your database as strings with a non-standard format, then that's what you should change. Store and transport things in standard formats. That's what the date input expects: a date in the standard ISO format. There's nothing American in that format.

fallen egret
#

my bank stores the date in yyyy-MM-dd format

ivory cradle
#

So you store dates in a database. Which database? Using which data type? Once you read it from the database, how to you transfer it to the client? If you transfer it using a non-standard format, then change that. use ISO.

ivory cradle
fallen egret
ivory cradle
#

IMO, they should always be transferred in ISO format. But I have no idea of what you're using on the backend, so I can't answer that question.