Fix somewhat ridiculous formatMoney
to work with negative amounts
This commit is contained in:
parent
6bdb490992
commit
4ab843d34f
|
@ -13,7 +13,9 @@ export function formatMoney(amount: number) {
|
||||||
Math.round(amount) === 0
|
Math.round(amount) === 0
|
||||||
? 0
|
? 0
|
||||||
: // Handle 499.9999999999999 case
|
: // Handle 499.9999999999999 case
|
||||||
Math.floor(amount + 0.00000000001 * Math.sign(amount))
|
(amount > 0 ? Math.floor : Math.ceil)(
|
||||||
|
amount + 0.00000000001 * Math.sign(amount)
|
||||||
|
)
|
||||||
return ENV_CONFIG.moneyMoniker + formatter.format(newAmount).replace('$', '')
|
return ENV_CONFIG.moneyMoniker + formatter.format(newAmount).replace('$', '')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user