I have a form that the user is filling out that includes a date that the user can set. At the moment the date objects are in the following format
"2021-07-29T00:16:20.391Z"
Using this answer I was able to convert it with the new Date()
constructor
let readable = new Date(date)
At this point the date is Sun Aug 01 2021 17:16:20 GMT-0700 (Pacific Daylight Time)
I can see it in the browser console.
This format is what I want, however it is an object so I cannot display it on the page like I need to. So I use JSON.Stringify()
.
let stringTime = JSON.stringify(readable)
This allows the time to be shown on the page, however it reverts to the original format of "2021-07-29T00:16:20.391Z"
I can't seem to get the readable
Object to display on the page without reverting to the hard to read date format.
What am I missing here?