#matInput type required format yyyy-MM-dd
1 messages · Page 1 of 1 (latest)
Yup. I understood the error. But how do I bring in the correct format for the input date? I added the format type= date | date:"yyyy-MM-dd" but it didn't allow me to change the data
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?
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?
here ts @Inject(MAT_DIALOG_DATA) public data: IDialogAddEditTeto
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?
It's because my default is pt_BR. However, in the exhibition it asks for the American format
database. and there it is stored in the standard, American format
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.
my bank stores the date in yyyy-MM-dd format
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.
Great then. That's the correct format. Don't change it.
Then. I set my dates to return in pt_BR format. How do I, just in this case, return me in ISO format?
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.