From 5dd2b9ff61cb8e4b4b9d94956fe88e471007a03a Mon Sep 17 00:00:00 2001 From: Puniko Date: Sun, 19 Feb 2023 15:36:01 +0100 Subject: [PATCH] fix duration format and add hours --- packages/client/src/components/wavesurfer.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/client/src/components/wavesurfer.vue b/packages/client/src/components/wavesurfer.vue index 3a255ef93..b90725273 100644 --- a/packages/client/src/components/wavesurfer.vue +++ b/packages/client/src/components/wavesurfer.vue @@ -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; }