Skip to content

Commit 657571a

Browse files
committed
A0-3207: Fix balance display zero padding
1 parent 6d736b2 commit 657571a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/node_modules/@polkadot-cloud/utils/index.js b/node_modules/@polkadot-cloud/utils/index.js
2+
index 39b849d..dac9a30 100644
3+
--- a/node_modules/@polkadot-cloud/utils/index.js
4+
+++ b/node_modules/@polkadot-cloud/utils/index.js
5+
@@ -68,11 +68,11 @@ var unitToPlanck = function (val, units) {
6+
.integerValue();
7+
};
8+
var minDecimalPlaces = function (val, minDecimals) {
9+
- var whole = new BigNumber(val.split(".")[0] || 0);
10+
+ var whole = new BigNumber(val.replaceAll(',', '').split(".")[0] || 0);
11+
var decimals = val.split(".")[1] || "";
12+
var missingDecimals = new BigNumber(minDecimals).minus(decimals.length);
13+
return missingDecimals.isGreaterThan(0)
14+
- ? "".concat(whole.toString(), ".").concat(decimals.toString()).concat("0".repeat(missingDecimals.toNumber()))
15+
+ ? "".concat(whole.toFormat(), ".").concat(decimals.toString()).concat("0".repeat(missingDecimals.toNumber()))
16+
: val;
17+
};
18+
var rmCommas = function (val) { return val.replace(/,/g, ""); };

0 commit comments

Comments
 (0)