So, I am facing an issue with a plugin that generates an array of dates without the ability to modify it. This plugin is embedded in the app's core and pulls data from a central database.
The problem lies in the fact that the array of dates includes the local timezone offset. Here is an example of how the elements look:
0: Thu Apr 11 2019 00:00:00 GMT+0100 (Hora de verano de Europa occidental)
1: Fri Apr 12 2019 00:00:00 GMT+0100 (Hora de verano de Europa occidental)
When I pass this array to a web service using axios and do:
JSON.stringify(MyArray)
The values are converted to a text format with the timezone offset applied:
"2019-04-10T23:00:00.000Z"
As a result, instead of displaying 00:00:00
, it shows 23:00:00
and the day before the actual date due to the timezone offset.
Does anyone know of a workaround to convert the full array to GMT or make JSON.stringify
ignore the timezone?