Issue
I have this problem:
From the backend I get the date in the format: 2022-05-20
When I want to edit the date I get an error: Internal Server Error Text '2023-04-29T22:00:00.000Z' could not be parsed, unparsed text found at index 10.
Solution
If you have a string in your form and the service expects a date, then you need to go from string to date.
Date.parse(val: string): Date is what you need or like kind.
See this:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse
or for more formats and flexibility a library:
Typescript parse string dd-mm-yyyy to date
If it is the reverse and you have a date and need a string, then the format function you list has the signature you need.
Answered By - Randy
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.