Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update with notes about validity for zips #2963

Merged
merged 3 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/default/address.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ Faker::Address.mail_box #=> "PO Box 123"

Faker::Address.community #=> "University Crossing"

#note: #zip_code will return a random string in zipcode format; may or may not be a valid zip for locale
Faker::Address.zip_code #=> "58517" or "23285-4905"

#note: #zip will return a random string in zipcode format; may or may not be a valid zip for locale
Faker::Address.zip #=> "58517" or "66259-8212"

#note: #postcode will return a random string in postcode format; may or may not be a valid zip for locale
Faker::Address.postcode #=> "76032-4907" or "58517"

Faker::Address.time_zone #=> "Asia/Yakutsk"
Expand Down
4 changes: 2 additions & 2 deletions lib/faker/default/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def zip_code(state_abbreviation: '')
return numerify(letterified_string, leading_zero: true)
end

# provide a zip code that is valid for the state provided
# see http://www.fincen.gov/forms/files/us_state_territory_zip_codes.pdf
# provide a zip code that may be valid for the state provided
# note: zip code may appear in the correct format for the state provided but may not be an actual state zip.
garrettgregor marked this conversation as resolved.
Show resolved Hide resolved
bothify(fetch("address.postcode_by_state.#{state_abbreviation}"))
end

Expand Down
Loading