I want to subtract two dates to get the difference between them. Hours and minutes are what interests me. The two dates will always be on the same day.
I have the following code:
const differenceAsDate = new Date(toTime.getTime() - fromTime.getTime());
Let's assume that toTime = Wed Mar 18 2020 07:00:00 GMT+0100
and fromTime = Wed Mar 18 2020 08:00:00 GMT+0100
so they are one hour apart.
This resulting date is Thu Jan 01 1970 02:00:00 GMT+0100
. How can I fix this?