🛠️ Feature Specification: Dynamic Global Postal Code Validator
CREATE TABLE user_addresses ( id SERIAL PRIMARY KEY, street_address VARCHAR(255), city VARCHAR(100), state_province VARCHAR(100), -- Always use VARCHAR for postal codes to keep leading zeros postal_code VARCHAR(12) NOT NULL, country_code CHAR(2) NOT NULL ); Use code with caution. Copied to clipboard 4. API Response Model (JSON)
This technical feature enables your application to accept, parse, and validate both 5-digit US ZIP codes and 6-digit international postal codes (like China's 015107 ) without failing. 1. User Interface (UI) Behavior : Create a single "Postal / ZIP Code" text field.
{ "input_code": "015107", "is_valid": true, "country": "China", "country_iso": "CN", "region": "Inner Mongolia", "city": "Bayannur" } Use code with caution. Copied to clipboard js backend API endpoint ?
: Do not force a hard 5-digit limit or automatic hyphenation until the user's country is selected.
as it contains six digits, whereas US ZIP codes strictly use five digits (or nine digits for ZIP+4). However, 015107 serves as a valid postal code for Bayannur, Inner Mongolia, China .
015107: Zip
🛠️ Feature Specification: Dynamic Global Postal Code Validator
CREATE TABLE user_addresses ( id SERIAL PRIMARY KEY, street_address VARCHAR(255), city VARCHAR(100), state_province VARCHAR(100), -- Always use VARCHAR for postal codes to keep leading zeros postal_code VARCHAR(12) NOT NULL, country_code CHAR(2) NOT NULL ); Use code with caution. Copied to clipboard 4. API Response Model (JSON) 015107 zip
This technical feature enables your application to accept, parse, and validate both 5-digit US ZIP codes and 6-digit international postal codes (like China's 015107 ) without failing. 1. User Interface (UI) Behavior : Create a single "Postal / ZIP Code" text field. Copied to clipboard js backend API endpoint
{ "input_code": "015107", "is_valid": true, "country": "China", "country_iso": "CN", "region": "Inner Mongolia", "city": "Bayannur" } Use code with caution. Copied to clipboard js backend API endpoint ? "region": "Inner Mongolia"
: Do not force a hard 5-digit limit or automatic hyphenation until the user's country is selected.
as it contains six digits, whereas US ZIP codes strictly use five digits (or nine digits for ZIP+4). However, 015107 serves as a valid postal code for Bayannur, Inner Mongolia, China .