fix: correctly calculate amount of minutes when an hour is present

This commit is contained in:
Lei Nelissen
2023-04-23 01:14:56 +02:00
parent 4ff071d0c8
commit 2e816f4a71

View File

@@ -3,7 +3,7 @@ function ticksToDuration(ticks: number) {
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
return `${hours > 0 ? hours + ':' : ''}${minutes}:${(seconds % 60).toString().padStart(2, '0')}`;
return `${hours > 0 ? hours + ':' : ''}${(minutes % 60).toString().padStart(hours > 0 ? 2 : 0, '0')}:${(seconds % 60).toString().padStart(2, '0')}`;
}
export default ticksToDuration;