diff --git a/plugins/woocommerce-blocks/package.json b/plugins/woocommerce-blocks/package.json index cd63f8a5ca4..45f4c6d706b 100644 --- a/plugins/woocommerce-blocks/package.json +++ b/plugins/woocommerce-blocks/package.json @@ -288,7 +288,7 @@ "fast-deep-equal": "^3.1.3", "fast-sort": "^3.4.0", "html-react-parser": "3.0.4", - "postcode-validator": "3.8.15", + "postcode-validator": "3.9.2", "preact": "^10.19.3", "prop-types": "^15.8.1", "react-number-format": "4.9.3", diff --git a/plugins/woocommerce-blocks/packages/checkout/utils/validation/is-postcode.ts b/plugins/woocommerce-blocks/packages/checkout/utils/validation/is-postcode.ts index ec2ca97a1c3..2ab21d238b9 100644 --- a/plugins/woocommerce-blocks/packages/checkout/utils/validation/is-postcode.ts +++ b/plugins/woocommerce-blocks/packages/checkout/utils/validation/is-postcode.ts @@ -13,6 +13,7 @@ const CUSTOM_REGEXES = new Map< string, RegExp >( [ [ 'JP', /^([0-9]{3})([-]?)([0-9]{4})$/ ], [ 'KH', /^[0-9]{6}$/ ], // Cambodia (6-digit postal code). [ 'LI', /^(94[8-9][0-9])$/ ], + [ 'MN', /^[0-9]{5}(-[0-9]{4})?$/ ], // Mongolia (5-digit postal code or 5-digit postal code followed by a hyphen and 4-digit postal code). [ 'NI', /^[1-9]{1}[0-9]{4}$/ ], // Nicaragua (5-digit postal code) [ 'NL', /^([1-9][0-9]{3})(\s?)(?!SA|SD|SS)[A-Z]{2}$/i ], [ 'SI', /^([1-9][0-9]{3})$/ ], diff --git a/plugins/woocommerce/changelog/50279-fix-mongolia-postcode-5 b/plugins/woocommerce/changelog/50279-fix-mongolia-postcode-5 new file mode 100644 index 00000000000..b6f3ac11940 --- /dev/null +++ b/plugins/woocommerce/changelog/50279-fix-mongolia-postcode-5 @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Adjust Mongolia postcode validation to be 5 digits or 5 digits followed by 4 digits. \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2a972c8f247..296a64d656a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4025,8 +4025,8 @@ importers: specifier: 3.0.4 version: 3.0.4(react@18.3.1) postcode-validator: - specifier: 3.8.15 - version: 3.8.15 + specifier: 3.9.2 + version: 3.9.2 preact: specifier: ^10.19.3 version: 10.19.3 @@ -20623,8 +20623,8 @@ packages: resolution: {integrity: sha512-xTgYBc3fuo7Yt7JbiuFxSYGToMoz8fLoE6TC9Wx1P/u+LfeThMOAqmuyECnlBaaJb+u1m9hHiXUEtwW4OzfUJg==} engines: {node: '>=0.10.0'} - postcode-validator@3.8.15: - resolution: {integrity: sha512-B2oeZ4E9D7JBHk0GEo0lv9aqHGd6vv+VsWoTG6Jt0tMtc5RUzSXOSQixBZgAAn4A/Dbajp8GbwzMtUkkyYw2Ig==} + postcode-validator@3.9.2: + resolution: {integrity: sha512-C+oaXif+z+mAN1EWDZG/EM2dnrUxRQR0gpMq8VeLSZwHuT3Bqo4hR3+k7OaEevPl0VK/7W27JwEQb24CbdtzuQ==} postcss-calc@7.0.5: resolution: {integrity: sha512-1tKHutbGtLtEZF6PT4JSihCHfIVldU72mZ8SdZHIYriIZ9fh9k9aWSppaT8rHsyI3dX+KSR+W+Ix9BMY3AODrg==} @@ -56933,7 +56933,7 @@ snapshots: posix-character-classes@0.1.1: {} - postcode-validator@3.8.15: {} + postcode-validator@3.9.2: {} postcss-calc@7.0.5: dependencies: