Альтертанивный вариант (извиняюсь что без новомодных let и =>)
function getDiff(startDate, endDate) {
// var date1 = new Date(startDate);
// var date2 = new Date(endDate);
// var diff = Math.abs(date2-date1);
var diff = Math.abs(new Date(endDate) - new Date(startDate));
diff = (diff-(diff%1000))/1000;
var seconds = diff % 60;
diff = (diff-seconds)/60;
var minutes = diff % 60;
diff = (diff-minutes)/60;
var hours = diff % 24;
var days = (diff-hours)/24;
return days+"d "+hours+"h "+minutes+"m "+seconds+"s";
}