Skip to content

Commit

Permalink
Avoid -0 notation
Browse files Browse the repository at this point in the history
  • Loading branch information
mountiny committed Aug 17, 2023
1 parent 81670fd commit 0acfcb7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/libs/TransactionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,14 @@ function getAmount(transaction, isFromExpenseReport) {
// Expense report case:
// The amounts are stored using an opposite sign and negative values can be set,
// we need to return an opposite sign than is saved in the transaction object
const amount = lodashGet(transaction, 'modifiedAmount', 0);
let amount = lodashGet(transaction, 'modifiedAmount', 0);
if (amount) {
return -amount;
}
return -lodashGet(transaction, 'amount', 0);

// To avoid -0 being shown, lets only change the sign if the value is other than 0.
amount = lodashGet(transaction, 'amount', 0);
return amount ? -amount : 0;
}

/**
Expand Down

0 comments on commit 0acfcb7

Please sign in to comment.