Skip to content

Commit

Permalink
Merge pull request Expensify#35230 from dukenv0307/fix/34668
Browse files Browse the repository at this point in the history
fix: incorrect error message appear when enter Cyrillic letters into Zip field
  • Loading branch information
jasperhuangg authored Feb 9, 2024
2 parents c930009 + 1834a74 commit 4b68bc5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/AddressForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function AddressForm({city, country, formID, onAddressChanged, onSubmit, shouldS
if (countrySpecificZipRegex) {
if (!countrySpecificZipRegex.test(values.zipPostCode.trim().toUpperCase())) {
if (ValidationUtils.isRequiredFulfilled(values.zipPostCode.trim())) {
errors.zipPostCode = ['privatePersonalDetails.error.incorrectZipFormat', {zipFormat: countryZipFormat}];
errors.zipPostCode = ['privatePersonalDetails.error.incorrectZipFormat', countryZipFormat];
} else {
errors.zipPostCode = 'common.error.fieldRequired';
}
Expand Down
3 changes: 1 addition & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import type {
FormattedMaxLengthParams,
GoBackMessageParams,
GoToRoomParams,
IncorrectZipFormatParams,
InstantSummaryParams,
LocalTimeParams,
LoggedInAsParams,
Expand Down Expand Up @@ -1176,7 +1175,7 @@ export default {
dateShouldBeBefore: ({dateString}: DateShouldBeBeforeParams) => `Date should be before ${dateString}.`,
dateShouldBeAfter: ({dateString}: DateShouldBeAfterParams) => `Date should be after ${dateString}.`,
hasInvalidCharacter: 'Name can only include Latin characters.',
incorrectZipFormat: ({zipFormat}: IncorrectZipFormatParams) => `Incorrect zip code format.${zipFormat ? ` Acceptable format: ${zipFormat}` : ''}`,
incorrectZipFormat: (zipFormat?: string) => `Incorrect zip code format.${zipFormat ? ` Acceptable format: ${zipFormat}` : ''}`,
},
},
resendValidationForm: {
Expand Down
3 changes: 1 addition & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import type {
FormattedMaxLengthParams,
GoBackMessageParams,
GoToRoomParams,
IncorrectZipFormatParams,
InstantSummaryParams,
LocalTimeParams,
LoggedInAsParams,
Expand Down Expand Up @@ -1173,7 +1172,7 @@ export default {
error: {
dateShouldBeBefore: ({dateString}: DateShouldBeBeforeParams) => `La fecha debe ser anterior a ${dateString}.`,
dateShouldBeAfter: ({dateString}: DateShouldBeAfterParams) => `La fecha debe ser posterior a ${dateString}.`,
incorrectZipFormat: ({zipFormat}: IncorrectZipFormatParams) => `Formato de código postal incorrecto.${zipFormat ? ` Formato aceptable: ${zipFormat}` : ''}`,
incorrectZipFormat: (zipFormat?: string) => `Formato de código postal incorrecto.${zipFormat ? ` Formato aceptable: ${zipFormat}` : ''}`,
hasInvalidCharacter: 'El nombre sólo puede incluir caracteres latinos.',
},
},
Expand Down
3 changes: 0 additions & 3 deletions src/languages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ type DateShouldBeBeforeParams = {dateString: string};

type DateShouldBeAfterParams = {dateString: string};

type IncorrectZipFormatParams = {zipFormat?: string};

type WeSentYouMagicSignInLinkParams = {login: string; loginType: string};

type ToValidateLoginParams = {primaryLogin: string; secondaryLogin: string};
Expand Down Expand Up @@ -315,7 +313,6 @@ export type {
FormattedMaxLengthParams,
GoBackMessageParams,
GoToRoomParams,
IncorrectZipFormatParams,
InstantSummaryParams,
LocalTimeParams,
LoggedInAsParams,
Expand Down

0 comments on commit 4b68bc5

Please sign in to comment.