Date format in database: 2023-08-19T04:03:57
The entry above was made at 12:03 AM EST.
new Date("2023-08-19T04:03:57")
= 2023-08-19T08:03:57.000Z
This doesn't give me the intended results. .toLocaleString
will give me 4:03 AM EST.
If I manually append the "Z":
new Date("2023-08-19T04:03:57Z")
= 2023-08-19T04:03:57.000Z
I'm given the intended result and can use localize functions properly.
Why is this happening and is there a better solution that manually appending a "Z" each time I need to use these timestamps on client machines?