From 2e816f4a71f563de25032daa78c1310bdc320c58 Mon Sep 17 00:00:00 2001 From: Lei Nelissen Date: Sun, 23 Apr 2023 01:14:56 +0200 Subject: [PATCH] fix: correctly calculate amount of minutes when an hour is present --- src/utility/ticksToDuration.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utility/ticksToDuration.ts b/src/utility/ticksToDuration.ts index 493d4ee..9b53a70 100644 --- a/src/utility/ticksToDuration.ts +++ b/src/utility/ticksToDuration.ts @@ -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; \ No newline at end of file