Skip to content

Commit

Permalink
Merge pull request Expensify#39486 from bernhardoj/fix/39168-address-…
Browse files Browse the repository at this point in the history
…zip-code-validation

Fix user can save address without zip code even when the country requires zip code
  • Loading branch information
MonilBhavsar authored Apr 4, 2024
2 parents 6fb92cf + e9057d7 commit 3dad025
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/AddressForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ function AddressForm({

ErrorUtils.addErrorMessage(errors, 'firstName', 'bankAccount.error.firstName');

if (countrySpecificZipRegex && values.zipPostCode) {
if (!countrySpecificZipRegex.test(values.zipPostCode.trim().toUpperCase())) {
if (ValidationUtils.isRequiredFulfilled(values.zipPostCode.trim())) {
if (countrySpecificZipRegex) {
if (!countrySpecificZipRegex.test(values.zipPostCode?.trim().toUpperCase())) {
if (ValidationUtils.isRequiredFulfilled(values.zipPostCode?.trim())) {
errors.zipPostCode = ['privatePersonalDetails.error.incorrectZipFormat', countryZipFormat];
} else {
errors.zipPostCode = 'common.error.fieldRequired';
Expand Down

0 comments on commit 3dad025

Please sign in to comment.