feat: refactoring

This commit is contained in:
Boris Cherepanov
2026-03-23 14:22:44 +03:00
parent 5a5dab85d0
commit 8cac2d1160
5 changed files with 236 additions and 142 deletions
+14
View File
@@ -0,0 +1,14 @@
function pad(n: number) {
return String(n).padStart(2, '0')
}
export function fmt(secs: number) {
if (!secs || Number.isNaN(secs)) return '0:00'
const s = Math.floor(secs)
const m = Math.floor(s / 60)
const h = Math.floor(m / 60)
if (h > 0) {
return `${h}:${pad(m % 60)}:${pad(s % 60)}`
}
return `${m}:${pad(s % 60)}`
}