Closed ildar170975 closed 2 years ago
t += ':' + Math.floor(x%60).toString().padStart(2,'0');
Can we have a rounding here instead of just "floor"?
rounding of 59.6 would display 60 would be confusing
From another side, conversion from float to hh:mm:ss should be mathematically as precise as possible ...
this would be ok
x=Math.round(x);
t = (x>=3600 || f)? Math.floor(x/3600).toString().padStart(2,'0') + ':' : '';
t += (Math.floor(x/60)-Math.floor(x/3600)*60).toString().padStart(2,'0');
if( !u ){
t += ':' + Math.round(x%60).toString().padStart(2,'0');
}
return t;
Cannot verify it quickly, unfortunately, I am about C/C++ basically, know JS worse ((((
we round it first before processing so 59.6 would become 60 so will display as 01:00
Very good! I will try to test all these cases when you create the updated release.
Tested, seems to be OK! Thank you!
Consider this example:
Output is: