Skip to content

Commit

Permalink
Merge pull request #20735 from dukenv0307/fix/20569
Browse files Browse the repository at this point in the history
Fix: Uppercase zipcode before validating or submiting
  • Loading branch information
mountiny authored Jun 15, 2023
2 parents 9727956 + 922cdd0 commit f15e6dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pages/settings/Profile/PersonalDetails/AddressPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const defaultProps = {
* @param {Object} values - form input values
*/
function updateAddress(values) {
PersonalDetails.updateAddress(values.addressLine1.trim(), values.addressLine2.trim(), values.city.trim(), values.state.trim(), values.zipPostCode.trim(), values.country);
PersonalDetails.updateAddress(values.addressLine1.trim(), values.addressLine2.trim(), values.city.trim(), values.state.trim(), values.zipPostCode.trim().toUpperCase(), values.country);
}

function AddressPage(props) {
Expand Down Expand Up @@ -104,14 +104,14 @@ function AddressPage(props) {
const countryZipFormat = lodashGet(countryRegexDetails, 'samples');

if (countrySpecificZipRegex) {
if (!countrySpecificZipRegex.test(values.zipPostCode.trim())) {
if (!countrySpecificZipRegex.test(values.zipPostCode.trim().toUpperCase())) {
if (ValidationUtils.isRequiredFulfilled(values.zipPostCode.trim())) {
errors.zipPostCode = ['privatePersonalDetails.error.incorrectZipFormat', {zipFormat: countryZipFormat}];
} else {
errors.zipPostCode = 'common.error.fieldRequired';
}
}
} else if (!CONST.GENERIC_ZIP_CODE_REGEX.test(values.zipPostCode.trim())) {
} else if (!CONST.GENERIC_ZIP_CODE_REGEX.test(values.zipPostCode.trim().toUpperCase())) {
errors.zipPostCode = 'privatePersonalDetails.error.incorrectZipFormat';
}

Expand Down

0 comments on commit f15e6dc

Please sign in to comment.