: -
let time:any = new Date("2017-03-05 11:26:16").getHours();
let date2:any = new Date("2017-03-06 12:26:16").getHours();
console.log(time -date2, time, date2, "sdfsd");
NaN
this is due to the fact that you use the character +before the date, which converts the date of the date to the number format, so it returns NAN (not a number)
source
share