I'm trying to convert the string 2022-02-01T13:36:57+00:00 to a Date object javascript that returns me Tue Feb 01 2022 13:36:57 without considering the timezone.
But everytime that I try to convert the date it returns: Tue Feb 01 2022 10:36:57 GMT-0300 (Brasilia Standard Time)
I already tried with moment: let now = moment("2022-02-01T13:36:57+00:00").toDate();
with Date: let now = new Date("2022-02-01T13:36:57+00:00");
with UTC too: new Date(Date.UTC(2022, 02, 01, 10, 36, 57))
But all of them returns me the local date (Brasilia Standard Time)
So, the question is:
How can I convert this string 2022-02-01T13:36:57+00:00 to a Date object that keeps the same day, hour, etc ?
new Date("2022-02-01T13:36:57+00:00"). The default toString method displays local values, use toISOString to see UTC (+0) values.