From b550bbe07dba66520355c2a435efbcf4bda64ac1 Mon Sep 17 00:00:00 2001 From: mantikoros Date: Wed, 9 Mar 2022 23:17:26 -0600 Subject: [PATCH] formatMoney: handle minus zero --- common/util/format.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/util/format.ts b/common/util/format.ts index 9b202d25..4507bada 100644 --- a/common/util/format.ts +++ b/common/util/format.ts @@ -6,7 +6,8 @@ const formatter = new Intl.NumberFormat('en-US', { }) export function formatMoney(amount: number) { - return 'M$ ' + formatter.format(amount).replace('$', '') + const newAmount = Math.round(amount) === 0 ? 0 : amount // handle -0 case + return 'M$ ' + formatter.format(newAmount).replace('$', '') } export function formatWithCommas(amount: number) {