Skip to content

Commit

Permalink
fix: decimals for amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
wainola committed Feb 28, 2024
1 parent 2056a92 commit 14336ce
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/utils/Helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down

0 comments on commit 14336ce

Please sign in to comment.