From 26149d5a017b00b37c94dfa99aef2818bdcf5b5f Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 19 Mar 2021 23:08:41 -0400 Subject: [PATCH] fix numeralWrapper should not return NaN anymore as it'll default to 1e+X. --- src/ui/numeralFormat.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ui/numeralFormat.ts b/src/ui/numeralFormat.ts index 67430636c..438701463 100644 --- a/src/ui/numeralFormat.ts +++ b/src/ui/numeralFormat.ts @@ -37,7 +37,12 @@ class NumeralFormatter { format(n: number, format: string): string { // numeraljs doesnt properly format numbers that are too big or too small if (Math.abs(n) < 1e-6) { n = 0; } - return numeral(n).format(format); + console.log(`${n}: ${numeral(n).format(format)}`); + const answer = numeral(n).format(format); + if (answer === 'NaN') { + return `${n}`; + } + return answer; } formatBigNumber(n: number): string {