I'm working in an Angular 6 front end and receive from another system time stamps which have no time zones (C# backend, DateTime). I suspect that javascript is automatically adding the local time zone to Date objects.
Example:
Receiving from backend: 2018-10-15T07:53:00.000Z
When console logging: console.log(timestamp) // Mon Oct 15 2018 09:53:00 GMT+0200
I am using moment.js and already tried moment.utc()
and moment(DATE).utc()
. But it still adds the local time zone especially because I have to re-transform my moment objects back to the type Date
with .toDate()
.
How can I resolve the time zone difference and get back a utc date to work with or the same structure as received?