I have an application where I am calling the function Date.parse as follows:
Date.parse('2021-02-22' + ' ' + '13:00')
However, when I run the app locally and in production (AWS), this function seems to return two different results. Locally it returns 1613959200000 while in production it returns 1613998800000. Upon further investigation, 1613959200000 seems to convert to 2021-02-22 at 13:00 in Australian Eastern Daylight time, while 1613998800000 converts to 2021-02-22 at 13:00 in UTC time. Is there a way I can force Date.parse() to convert for the local timezone of the client/browser, rather than UTC? (in this case Australian Eastern Daylight time, but I'd want it to work for all timezones).
EDIT: I have tried using date objects, in order to produce a date/time object that is in sync with the local timezone, but it doesn't seem to work as shown in the code below:
var d = new Date("Mon Feb 22 2021 00:00:00 GMT+1100 (Australian Eastern Daylight Time)");
var ds = d.toString();
var e = new Date(2021,2,22,0,0)
var es = e.toString();
console.log(ds === es) //returns false for some reason