Skip to content

Commit

Permalink
Fix ending on negative time
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlul committed Dec 5, 2024
1 parent ebc7959 commit f18fe02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/timer/PersistentTimer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f18fe02

Please sign in to comment.