Method for obtaining state based on a zipcode?
seanr opened this issue · 1 comments
seanr commented
If I'm given a zipcode, is there some way I can use this package to obtain the state the zipcode is within? We already have this package in our site since we're using the Drupal address module, but in this case, the zipcode is being entered by the user into a search field and I want the site to react if the search is within a specific state (Massachusetts in our case).
bojanz commented
You would need to maintain a list of postal code prefixes for each US state and then match the postal code against that.
Addressing 1.x has this data (and you can copy it into your module), but we removed it in 2.x because it was difficult to maintain while providing a confusing UX when validation failed.