forked from FoundKeyGang/FoundKey
fix duration format and add hours
This commit is contained in:
parent
98acca0a31
commit
5dd2b9ff61
1 changed files with 9 additions and 2 deletions
|
@ -80,13 +80,20 @@ onMounted(() => {
|
|||
});
|
||||
|
||||
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));
|
||||
if (sec < 10) {
|
||||
sec = '0' + sec;
|
||||
}
|
||||
if (min < 10) {
|
||||
sec = '0' + min;
|
||||
min = '0' + min;
|
||||
}
|
||||
if (hour > 0) {
|
||||
return hour + ':' + min + ':' + sec;
|
||||
}
|
||||
return min + ':' + sec;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue