function getHoursBetween2Dates(startDate, endDate) {
const millisecondsInHour = 1000 * 60 * 60;
return Math.round(Math.abs(endDate - startDate) / millisecondsInHour);
}
console.log(getHoursBetween2Dates(new Date(2022, 3, 28, 8, 40, 0), new Date(2022, 4, 2, 11, 01, 30)));
/*
run:
98
*/