From 58cc548739f3e1eb79d4952588493502f2acea5e Mon Sep 17 00:00:00 2001 From: Hellyson Rodrigo Parteka Date: Tue, 28 Sep 2021 04:27:55 -0300 Subject: [PATCH] fix: wrong minute count in long videos --- src/utils/time.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/time.ts b/src/utils/time.ts index 734cb00..07a8a64 100644 --- a/src/utils/time.ts +++ b/src/utils/time.ts @@ -1,12 +1,13 @@ export const prettyTime = (seconds: number): string => { const nSeconds = seconds % 60; - const nMinutes = Math.floor(seconds / 60); + let nMinutes = Math.floor(seconds / 60); const nHours = Math.floor(nMinutes / 60); let res = ''; if (nHours !== 0) { res += `${Math.round(nHours).toString().padStart(2, '0')}:`; + nMinutes -= nHours * 60; } res += `${Math.round(nMinutes).toString().padStart(2, '0')}:${Math.round(nSeconds).toString().padStart(2, '0')}`;