You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The en-US locale en-US.faker.phone_number.area_code array (see src/main/resources/en-US.yml, line 41022) includes area code 226, which is a Canadian area code. Phone numbers generated by java-faker with this area code will not pass validation checks asserting that they are valid US numbers.
To Reproduce
Since these are randomly generated phone numbers, reproducing this issue is difficult. However using a phone number with this area code that java-faker could generate, for example +12262011212, and Google's libphonenumber, you can demonstrate that this number does not pass validation. See example in Kotlin below:
fun validatePhoneNumber() {
val phoneNumber = "+12262011212"
val phoneUtil = PhoneNumberUtil.getInstance()
val proto = phoneUtil.parse(phoneNumber, "US")
println(phoneUtil.isValidNumberForRegion(proto, "US"))
}
Output: false
Running this function with a phone number of +12252011212, which has the valid area code 225, instead prints true.
Expected behavior
When set with the en-US locale, java-faker should not generate phone numbers with area code 226, as they are not valid US numbers.
Versions:
OS: OSX 11.5.2
JDK: openjdk version 11.0.11
Faker Version 1.0.2
Additional context
faker-ruby/faker had this same issue and resolved it in May 2021: faker-ruby/faker#2321
The North American Numbering Plan Administration, who sets the area codes, has this list published on their website, which lists 226 as an area code for Ontario.
The text was updated successfully, but these errors were encountered:
bodiam
added a commit
to datafaker-net/datafaker
that referenced
this issue
Jan 22, 2022
Describe the bug
The en-US locale
en-US.faker.phone_number.area_code
array (see src/main/resources/en-US.yml, line 41022) includes area code 226, which is a Canadian area code. Phone numbers generated by java-faker with this area code will not pass validation checks asserting that they are valid US numbers.To Reproduce
Since these are randomly generated phone numbers, reproducing this issue is difficult. However using a phone number with this area code that java-faker could generate, for example
+12262011212
, and Google's libphonenumber, you can demonstrate that this number does not pass validation. See example in Kotlin below:Running this function with a phone number of
+12252011212
, which has the valid area code 225, instead printstrue
.Expected behavior
When set with the en-US locale, java-faker should not generate phone numbers with area code 226, as they are not valid US numbers.
Versions:
Additional context
faker-ruby/faker had this same issue and resolved it in May 2021: faker-ruby/faker#2321
The North American Numbering Plan Administration, who sets the area codes, has this list published on their website, which lists 226 as an area code for Ontario.
The text was updated successfully, but these errors were encountered: