DownTime duration in hours not displaying the minutes
Hi community,
I am trying to display duration (difference between 2 dates). I converted it from decimal hours to hours.
The problem I am now facing is the minutes are not displaying. The duration only changes after an hour.
Below is the code that I have written. Does someone know How I can solve this problem.
var decimalTime = parseFloat(duration);
decimalTime = decimalTime * 60 * 60;
var hours = Math.floor((decimalTime / (60 * 60)));
decimalTime = decimalTime - (hours * 60 * 60);
var minutes = Math.floor((decimalTime / 60));
decimalTime = decimalTime - (minutes * 60);
var seconds = Math.round(decimalTime);
if(hours < 10)
{
hours = "0" + hours;
}
if(minutes < 10)
{
minutes = "0" + minutes;
}
let result = ("" + hours + ":" + minutes);
The desired output should be e.g., 16:00. Then after two minutes I should see 16:02. However currently I am only seeing a change after an hour (i.e. 17:00 after sixty minutes).
Many thanks

