From 6614833cb1e332b1aa5936f828bad9c650e0c41a Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Tue, 14 Jun 2022 03:44:14 -0700 Subject: [PATCH] Show one decimal point on clips --- common/util/format.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/util/format.ts b/common/util/format.ts index 10b7c1de..6260d74f 100644 --- a/common/util/format.ts +++ b/common/util/format.ts @@ -7,9 +7,13 @@ const formatter = new Intl.NumberFormat('en-US', { minimumFractionDigits: 0, }) +// export function formatMoney(amount: number) { +// const newAmount = Math.round(amount) === 0 ? 0 : Math.floor(amount) // handle -0 case +// return ENV_CONFIG.moneyMoniker + formatter.format(newAmount).replace('$', '') +// } + export function formatMoney(amount: number) { - const newAmount = Math.round(amount) === 0 ? 0 : Math.floor(amount) // handle -0 case - return ENV_CONFIG.moneyMoniker + formatter.format(newAmount).replace('$', '') + return ENV_CONFIG.moneyMoniker + amount.toFixed(1) } export function formatWithCommas(amount: number) {