1// date1 and date2 are date objects
2
3let hours = Math.abs(date1 - date2) / 36e5;
4
5// The subtraction returns the difference between the two dates in milliseconds.
6// 36e5 is the scientific notation for 60*60*1000, dividing by which converts
7// the milliseconds difference into hours.