diff --git a/materialious/src/lib/misc.ts b/materialious/src/lib/misc.ts index 83f052f7..6b423735 100644 --- a/materialious/src/lib/misc.ts +++ b/materialious/src/lib/misc.ts @@ -15,8 +15,17 @@ export function cleanNumber(number: number): string { export function videoLength(lengthSeconds: number): string { const hours = Math.floor(lengthSeconds / 3600); - const minutes = Math.floor((lengthSeconds % 3600) / 60); - const seconds = lengthSeconds % 60; + let minutes: number | string = Math.floor((lengthSeconds % 3600) / 60); + let seconds: number | string = lengthSeconds % 60; + + if (minutes < 10) { + minutes = `0${minutes}`; + } + + if (seconds < 10) { + seconds = `0${seconds}`; + } + if (hours !== 0) { return `${hours}:${minutes}:${seconds}`;