How to subtract hours in JavaScript from an input of type time?

Viewed 17

In the code below,I have two inputs of type time. I would like as soon as I click the button I can calculate the difference between these two times. How could I do this?

    function calc(){
        let start = document.getElementById('start').value;
        let end = document.getElementById('end').value;
   }
    
<input type="time" name="" id="start">
<input type="time" name="" id="end">
<button onclick="calc();"> TEST </button>

0 Answers
Related