'Calculate duration of two dates, first one is utc date, second is browser's local gmt time (London timezone)

I have an issue with the calculation of duration between two dates, one is UTC London time, and the second one is the browser's local time.

first date is 2022-04-20T08:29:55.614 (server's UTC time) second one is 2022-04-20T09:44:16.234 (browser's local time)

I calculate the difference by using the moment:

const differenceDate = moment.duration(currentDate.diff(startupDateTime))

The difference should be 14 minutes, but the result is 1 hour and 14 minutes.

I tried to use the moment-timezone library but the result was almost the same.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source