From cc5eca274098334596c4a7f03c1fa5e2b641c312 Mon Sep 17 00:00:00 2001 From: Samar Mohan Date: Wed, 23 Feb 2022 06:35:09 -0600 Subject: [PATCH] display 0 if the time typing is NaN. (#2571) --- frontend/src/scripts/account/all-time-stats.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/src/scripts/account/all-time-stats.ts b/frontend/src/scripts/account/all-time-stats.ts index cce9700c1..bf0594abf 100644 --- a/frontend/src/scripts/account/all-time-stats.ts +++ b/frontend/src/scripts/account/all-time-stats.ts @@ -14,13 +14,14 @@ export function update(): void { // let th = Math.floor(DB.getSnapshot().globalStats.time / 3600); // let tm = Math.floor((DB.getSnapshot().globalStats.time % 3600) / 60); // let ts = Math.floor((DB.getSnapshot().globalStats.time % 3600) % 60); - $(".pageAccount .globalTimeTyping .val").text( - Misc.secondsToString( - Math.round(snapshot.globalStats.time as number), - true, - true - ) - ); + const seconds = snapshot?.globalStats?.time ?? 0; + let string = ""; + if (seconds === 0) { + string = "-"; + } else { + string = Misc.secondsToString(seconds, true, true); + } + $(".pageAccount .globalTimeTyping .val").text(string); } if (snapshot.globalStats !== undefined) {