Skip to content

Commit 8cba886

Browse files
MelvinBotgrgia
andcommitted
Allow $0 as valid card limit when editing Expensify Card
The validation in DynamicExpensifyCardLimitPage used !Number(values.limit) to check for invalid amounts. Since Number('0') is 0 and !0 is true, a $0 limit was always rejected as invalid. This prevented editing cards whose limit was set to $0 in Expensify Classic. Changed the check to Number.isNaN(Number(values.limit)) which correctly allows 0 while still rejecting non-numeric input. Co-authored-by: Georgia Monahan <grgia@users.noreply.github.com>
1 parent c5403b4 commit 8cba886

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/pages/workspace/expensifyCard/DynamicExpensifyCardLimitPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function DynamicExpensifyCardLimitPage({route}: DynamicExpensifyCardLimitPagePro
105105
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.EDIT_EXPENSIFY_CARD_LIMIT_FORM>): FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_EXPENSIFY_CARD_LIMIT_FORM> => {
106106
const errors = getFieldRequiredErrors(values, [INPUT_IDS.LIMIT], translate);
107107

108-
if (!Number(values.limit)) {
108+
if (Number.isNaN(Number(values.limit))) {
109109
errors.limit = translate('iou.error.invalidAmount');
110110
} else if (!Number.isInteger(Number(values.limit))) {
111111
errors.limit = translate('iou.error.invalidIntegerAmount');

0 commit comments

Comments
 (0)