From 0acfcb72b5805c8ae4bf3596e58b6dbbafcd7a6e Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Thu, 17 Aug 2023 15:58:46 +0100 Subject: [PATCH] Avoid -0 notation --- src/libs/TransactionUtils.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js index 6e0932c5ec28..06ad190048c3 100644 --- a/src/libs/TransactionUtils.js +++ b/src/libs/TransactionUtils.js @@ -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; } /**