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

Validation failures on valid phone numbers from UK (Channel Islands) #252

Open
wilsonsilva opened this issue Feb 15, 2022 · 2 comments
Open
Labels
missing validation data data for some prefix/country is missing in the souce

Comments

@wilsonsilva
Copy link

I'm getting many validation failures on different phone numbers from the British Channel Islands (for example, Jersey).

@daddyz
Copy link
Owner

daddyz commented Feb 23, 2022

@wilsonsilva thanks for reporting.
This number is also parsed as invalid in original libphonenumber. You can check it here and open an issue for them. Gem's data is based on it.
You can wait for them to fix it or you can use this method (in your app initializer) to add missing validation regex like here:

Phonelib.add_additional_regex :gb, Phonelib::Core::FIXED_LINE, '1534\d{6}'

@daddyz daddyz added the missing validation data data for some prefix/country is missing in the souce label Feb 23, 2022
@agramichael
Copy link

agramichael commented May 26, 2022

In case anyone finds this and wants to add support for all numbers from Channel Islands (Guernsey, Isle of Man & Jersey):

Phonelib.additional_regexes = [
  [:gb, :fixed_line, '1534\d{6}'],
  [:gb, :fixed_line, '1481\d{6}'],
  [:gb, :fixed_line, '1624\d{6}'],
  [:gb, :mobile, '7781\d{6}'],
  [:gb, :mobile, '7839\d{6}'],
  [:gb, :mobile, '7911\d{6}'],
  [:gb, :mobile, '7509\d{6}'],
  [:gb, :mobile, '7797\d{6}'],
  [:gb, :mobile, '7937\d{6}'],
  [:gb, :mobile, '7700\d{6}'],
  [:gb, :mobile, '7829\d{6}'],
  [:gb, :mobile, '7624\d{6}'],
  [:gb, :mobile, '7524\d{6}'],
  [:gb, :mobile, '7924\d{6}']
] 

I will be using this until there are other easy ways to validate phone numbers belonging to one country from a list, in this case: [:gb, ;gg, :im, :je]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
missing validation data data for some prefix/country is missing in the souce
Projects
None yet
Development

No branches or pull requests

3 participants