JSchallenger

Calculate difference between two dates in hours, minutes, and seconds

Viewed: 194
Attempted: 36
Solved: 7
// This is a more difficult challenge
// Write a function that takes two date instances as arguments
// It should return an object with the properties 'hrs', 'min', and 'sec'
// The corresponding values should display the absolute difference between the two dates in hours, minutes, and seconds
//

function myFunction() {

return
}
Test Cases:
myFunction(new Date('2000/01/01 08:00:00'), new Date('2000/01/01 08:45:10'))
Expected
{ hrs: 0, min: 45, sec: 10 }
myFunction(new Date('2000/01/01 09:50:23'), new Date('2000/01/01 08:00:00'))
Expected
{ hrs: 1, min: 50, sec: 23 }
myFunction(new Date('2000/01/01 11:04:12'), new Date('2000/01/01 08:00:00'))
Expected
{ hrs: 3, min: 4, sec: 12 }