diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d2b0d71..b4e849e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Deduplicated test fixtures: shared Google Geocoder payloads (factory exported from `postalCodeGoogleAddress.js`), address/geolocation mock bases, and `sharedMockRuleFields` for `useOneLevel` / `useThreeLevels` to satisfy Sonar CPD on new code. +### Fixed + +- Virgin Islands' postal code validation + ## [3.42.0] - 2025-12-09 ### Added diff --git a/react/country/VIR.ts b/react/country/VIR.ts index c332073e..9565c8fd 100644 --- a/react/country/VIR.ts +++ b/react/country/VIR.ts @@ -19,8 +19,8 @@ const rules: PostalCodeRules = { fixedLabel: 'ZIP', required: true, mask: '99999-9999', - regex: '^008(01|02|03|04|05|20|21|22|23|24|30|31|40|41|50|51)-\d{0,4}$', - // Asserts zipcode starts with 008, then contains one of the local accepted area values, then followed by hyphen and 4 digits. + regex: '^008(01|02|03|04|05|20|21|22|23|24|30|31|40|41|50|51)(-\d{4})?$', + // Asserts zipcode starts with 008, then contains one of the local accepted area values, optionally followed by hyphen and exactly 4 digits. postalCodeAPI: true, forgottenURL: 'https://tools.usps.com/go/ZipLookupAction!input.action', size: 'small',