Calculate duration by start and end hour
11:19 01 Apr 2021

I have this json :

{
    endTime: "14:00:00"
    startTime: "12:00:00"
}

I need to calculate duration, so I did like this :

let duration = endTime.slice(0, -3) - startTime.slice(0, -3);

But not working as expected. I have a JS error: left-hand must be type number

What can I try next?

javascript typescript