Cimpress-MCP / postal-codes-js

Provide postal code validation for javascript
Apache License 2.0
43 stars 36 forks source link

US postal code validation #82

Open dimitriBouteille opened 8 months ago

dimitriBouteille commented 8 months ago

Wikipedia :

Known as the ZIP Code with five digits 99999 or the ZIP+4 Code with nine digits 99999-9999 (while the minimum requirement is the first five digits, the U.S. Postal Service encourages everyone to use all nine). Also used by the former US Pacific Territories: Federated States of Micronesia; Palau; and the Marshall Islands, as well as in current US territories American Samoa, Guam, Northern Mariana Islands, Puerto Rico, and the United States Virgin Islands. An individual delivery point may be represented as an 11-digit number, but these are usually represented by Intelligent Mail barcode or formerly POSTNET bar code.

The first digit is assigned regionally (for example, ZIP codes beginning with 9 are found in the western coastal states, Alaska, Hawaii, and islands in the Pacific), and ZIP codes with the same first three digits are served by the same USPS sorting facility (which sometimes serve multiple such groupings), so will be geographically clustered (for example, all ZIP codes in 919XX, 920XX, and 921XX are found in San Diego County, California).

Validation work some zip code :+1:

image (1)

But not working with this format :-1:

image (2)