From 14336cef8ad1d65a393bde786b6ddeb0701cac46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Riquelme=20Guzm=C3=A1n?= Date: Tue, 27 Feb 2024 23:06:15 -0300 Subject: [PATCH] fix: decimals for amounts --- src/utils/Helpers.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/utils/Helpers.tsx b/src/utils/Helpers.tsx index 20c53d9..28b54b7 100644 --- a/src/utils/Helpers.tsx +++ b/src/utils/Helpers.tsx @@ -209,13 +209,9 @@ export const formatTransferType = (transferType: ResourceTypes): string => { export const formatConvertedAmount = (amount: number): string => { if (typeof amount === "number") { - const splitedConvertedAmount = amount !== 0 ? amount.toString().split(".") : ["0", "00"] + const convertedAmount = amount !== 0 ? `$${amount.toFixed(1)}` : "$0.00" - const formatedConvertedAmount = `$${splitedConvertedAmount[0]}.${ - splitedConvertedAmount[1].length >= 3 ? splitedConvertedAmount[1].slice(0, 3) : splitedConvertedAmount[1] - }` - - return formatedConvertedAmount + return convertedAmount } return "$0.00" }