Skip to content

Commit

Permalink
fix: fixed formatted balance (#1751)
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulhakim2902 authored and irmannmal committed Mar 6, 2023
1 parent cdf1477 commit ac25b49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/components/BalanceDetailList/BalanceDetailList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export const BalanceDetailList: React.FC<BalanceDetailListProps> = props => {
</TableRow>
)}
{!isLoading &&
defaultBalanceDetails &&
defaultBalanceDetails.length > 0 &&
defaultBalanceDetails.map(balanceDetail => (
<TableRow key={balanceDetail.id} className={classes.tableRow}>
Expand Down
9 changes: 3 additions & 6 deletions src/helpers/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,9 @@ export const formatBalance = (
let mod = val.substring(val.length - decimal).replace(/0+$/, '');

if (val.length <= decimal) {
if (val.length === decimal) {
div = '0';
} else {
trailingZero = '0'.repeat(decimal - val.length);
mod = trailingZero + mod;
}
div = '0';
trailingZero = '0'.repeat(decimal - val.length);
mod = trailingZero + mod;
}

let maxDecimal = length;
Expand Down

0 comments on commit ac25b49

Please sign in to comment.