Could there be a way I can change my local timezone to a different timezone whenever I want to create a new date.
For example:
const date = new Date().timezone("GMT-04:00");
or
const date = new Date("GMT-04:00");
My local timezone is GMT+0:300 but I want that whenever I want to create a new Date, it's default timezone is GMT-04:00
(new Date(gmt)).toISOString()is not actually a valid thing. Is it true? Is there any alternate for getting ISO format?new Date(gmt).toISOString()is valid. The issue with the answer you linked to is explained in this comment, i.e. the built–in parser is not required to correctly parse the result of toLocaleString. There is also no standard for how to treat date and times in the DST changeover period and browsers treat it differently.