Date difference in hours - Angular 2
This should do the job:
const date1 = params.data.incidentTime;
const date2 = params.data.creationTime;
const diffInMs = Date.parse(date2) - Date.parse(date1);
const diffInHours = diffInMs / 1000 / 60 / 60;
console.log(diffInHours);
Use Math.floor
to round the result down, or Math.ceil
to round it up