Skip to content

Commit

Permalink
fix: edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
rostislav-deriv committed Dec 19, 2023
1 parent 508387e commit 50bac95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/wallets/src/hooks/useInputDecimalFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ const useInputDecimalFormatter = (initial?: number, options?: TOptions) => {

// The field have a decimal point and decimal places are already as allowed fraction
// digits, So we remove the extra decimal digits from the right and return the new value.
if (hasRight && right.length > fractionDigits) {
const newRight = right.substring(0, fractionDigits);
if (fractionDigits) {
const newRight = right ? right.substring(0, fractionDigits) : '0'.repeat(fractionDigits);

return `${left}.${newRight}`;
}
Expand Down

0 comments on commit 50bac95

Please sign in to comment.