fix duration format and add hours

This commit is contained in:
Puniko 2023-02-19 15:36:01 +01:00
parent 98acca0a31
commit 5dd2b9ff61

View file

@ -80,13 +80,20 @@ onMounted(() => {
}); });
function formatTime(value) { function formatTime(value) {
let min = Math.floor(value / 60); let hour = 0;
if ((value / 60) > 0) {
hour = Math.floor(value / 3600);
}
let min = Math.floor((value / 60) - hour * 60);
let sec = Math.floor(value - (min * 60)); let sec = Math.floor(value - (min * 60));
if (sec < 10) { if (sec < 10) {
sec = '0' + sec; sec = '0' + sec;
} }
if (min < 10) { if (min < 10) {
sec = '0' + min; min = '0' + min;
}
if (hour > 0) {
return hour + ':' + min + ':' + sec;
} }
return min + ':' + sec; return min + ':' + sec;
} }