I've been struggling with getting this system to function properly. Here's the issue I'm facing.
The dates I receive from the REST API come in various formats
(mm-dd-yyyy-timezone, mm-dd-yyy hh:mm:ss, yyyy-mm-dd-timezone, yyyy-mm-dd hh:mm:ss)
but I need to format them in the yyyy-mm-dd
style. To achieve this, I've used substring to extract the first 10 characters and obtain the Datestring while disregarding time and timezone information.
Throughout this process, an interesting observation has arisen.
new Date("08-11-1987") provides Tue Aug 11 1987 00:00:00 GMT-0700 (Pacific Daylight Time)
However,
new Date("1987-08-11") gives me Mon Aug 10 1987 17:00:00 GMT-0700 (Pacific Daylight Time)
I am puzzled by this one-day discrepancy when creating the Date object.