fix: fix duration format function (#1894)

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej
2024-06-08 23:41:44 +02:00
committed by GitHub
parent cec28d06f6
commit cf722ea35b

View File

@@ -239,13 +239,13 @@ export default class StatusPanelPrintstatusPrinting extends Mixins(BaseMixin) {
}
formatDuration(seconds: number) {
let prefix = seconds < 0 ? '-' : ''
const prefix = seconds < 0 ? '-' : ''
let absSeconds = Math.abs(seconds)
let h = Math.floor(absSeconds / 3600)
const h = Math.floor(absSeconds / 3600)
absSeconds %= 3600
let m = ('0' + Math.floor(absSeconds / 60)).slice(-2)
let s = ('0' + (absSeconds % 60).toFixed(0)).slice(-2)
const m = ('0' + Math.floor(absSeconds / 60)).slice(-2)
const s = ('0' + Math.floor(absSeconds % 60)).slice(-2)
return prefix + h + ':' + m + ':' + s
}