Skip to content

Commit

Permalink
Merge pull request #25734 from Expensify/aldo_fix-validation-amounts
Browse files Browse the repository at this point in the history
Only pass strings with a valid number to Str.fromUSDToNumber
  • Loading branch information
aldo-expensify committed Aug 23, 2023
2 parents 5048f2e + b955641 commit 2866504
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/ReimbursementAccount/ValidationStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 '';
}

Expand Down

0 comments on commit 2866504

Please sign in to comment.