Fix wrong timestamps for sub-60 second times

This commit is contained in:
Kuba Orlik 2024-02-02 08:41:36 +01:00
parent 2c4af55985
commit e19f8f9c00
1 changed files with 3 additions and 0 deletions

View File

@ -40,6 +40,9 @@ function toTimestamp(n: number): string {
result.push(n % 60);
n = Math.floor(n / 60);
}
if (result.length == 1) {
result.push(0); // to get timestamps like "00:03"
}
return result
.map((n, i) => (i >= 2 ? n.toString() : n.toString().padStart(2, "0")))
.reverse()