Minor improvements to thumbnail timestamps

This commit is contained in:
WardPearce
2024-03-26 19:06:37 +13:00
parent ca4b927b08
commit ede3e0556e
+11 -2
View File
@@ -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}`;