Skip to content

Commit

Permalink
fix: revert change on decimals format
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Oct 10, 2023
1 parent f18416b commit cf95a1d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/utils/format.number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,13 @@ export function formatLocalAmount(
if (isPercent) {
return formatCurrencyWithPrecision({amount, maxFractionDigits: 2, intlOptions, locale, symbol});
}
if (amount <= 0.000000000001) {
return formatCurrencyWithPrecision({amount, maxFractionDigits: 12, intlOptions, locale, symbol});
}
if (amount <= 0.00000001) {
if (amount > 0.00000001) {
return formatCurrencyWithPrecision({amount, maxFractionDigits: 8, intlOptions, locale, symbol});
}
if (amount > 0.000000000001) {
return formatCurrencyWithPrecision({amount, maxFractionDigits: 12, intlOptions, locale, symbol});
}
return formatCurrencyWithPrecision({amount, maxFractionDigits: decimals, intlOptions, locale, symbol});

}
return (
new Intl.NumberFormat([locale, 'en-US'], intlOptions)
Expand Down

0 comments on commit cf95a1d

Please sign in to comment.