From f18fe0262cef936de7946406d575d1b06beba48f Mon Sep 17 00:00:00 2001 From: kevinlul <6320810+kevinlul@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:25:18 -0500 Subject: [PATCH] Fix ending on negative time #647 --- src/timer/PersistentTimer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/timer/PersistentTimer.ts b/src/timer/PersistentTimer.ts index 04934b1a..2251613b 100644 --- a/src/timer/PersistentTimer.ts +++ b/src/timer/PersistentTimer.ts @@ -157,8 +157,8 @@ export class PersistentTimer { } public static formatTime(milli: number): string { - let minutes = Math.floor(milli / 1000 / 60); - const seconds = Math.floor(milli / 1000) % 60; + let minutes = Math.max(Math.floor(milli / 1000 / 60), 0); + const seconds = Math.max(Math.floor(milli / 1000) % 60, 0); if (minutes <= 60) { return `${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`; } else {