Skip to content

Commit

Permalink
feat: remove trailing zeros in decimal part
Browse files Browse the repository at this point in the history
  • Loading branch information
liorfrenkel committed Feb 26, 2020
1 parent 2982a23 commit 61442e3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/lib/AssetUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ export default {
const amountDivided = new Decimal(this.getAmountDivided(asset, amount));

if (this.isZP(asset)) {
const parsedAmount = amountDivided.floor().equals(amountDivided)
? amountDivided.toString()
: amountDivided.toFixed(8);
const parsedAmount = amountDivided.toFixed(Math.min(8, amountDivided.decimalPlaces()));
return `${TextUtils.formatNumber(parsedAmount)} ${this.getAssetNameFromCode(asset)}`;
}
return String(TextUtils.formatNumber(amount));
Expand Down

0 comments on commit 61442e3

Please sign in to comment.