Skip to content

Commit

Permalink
Update packages/web/utils/number.ts
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
crnbarr93 and coderabbitai[bot] authored Dec 28, 2024
1 parent a90ab85 commit b9b583f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/web/utils/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ export function fixDecimalCount(
return roundUpToDecimal(parseFloat(value), decimalCount).toString();
}
const split = value.split(".");
const integerPart = split[0];
const fractionalPart = split[1] ? split[1].substring(0, decimalCount) : "";
const result =
split[0] +
(decimalCount > 0 ? "." + split[1].substring(0, decimalCount) : "");
integerPart + (decimalCount > 0 ? "." + fractionalPart : "");
return result;
}

Expand Down

0 comments on commit b9b583f

Please sign in to comment.