From 5cff4b74a44b4ac0d026b17a9ef217d28a78049c Mon Sep 17 00:00:00 2001 From: Aldo Canepa Garay <87341702+aldo-expensify@users.noreply.github.com> Date: Tue, 22 Aug 2023 17:00:44 -0700 Subject: [PATCH] Merge pull request #25734 from Expensify/aldo_fix-validation-amounts Only pass strings with a valid number to Str.fromUSDToNumber (cherry picked from commit 2866504ce8b6617ce1418fc6e7d990f708c7aeba) --- src/pages/ReimbursementAccount/ValidationStep.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/ReimbursementAccount/ValidationStep.js b/src/pages/ReimbursementAccount/ValidationStep.js index 0afa855f1ea6..90dfc8060e19 100644 --- a/src/pages/ReimbursementAccount/ValidationStep.js +++ b/src/pages/ReimbursementAccount/ValidationStep.js @@ -67,7 +67,7 @@ class ValidationStep extends React.Component { const errors = {}; _.each(values, (value, key) => { - const filteredValue = this.filterInput(value); + const filteredValue = typeof value === 'string' ? this.filterInput(value) : value; if (ValidationUtils.isRequiredFulfilled(filteredValue)) { return; } @@ -103,7 +103,7 @@ class ValidationStep extends React.Component { */ filterInput(amount) { let value = amount ? amount.toString().trim() : ''; - if (value === '' || !Math.abs(Str.fromUSDToNumber(value)) || _.isNaN(Number(value))) { + if (value === '' || _.isNaN(Number(value)) || !Math.abs(Str.fromUSDToNumber(value))) { return ''; }