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

These phone numbers 07700900982 and +447708900982 are not valid #376

Open
dimylik opened this issue Oct 25, 2023 · 0 comments
Open

These phone numbers 07700900982 and +447708900982 are not valid #376

dimylik opened this issue Oct 25, 2023 · 0 comments

Comments

@dimylik
Copy link

dimylik commented Oct 25, 2023

Interesting case just randomly discovered,
numbers 07700900982 and +447708900982 are not valid, issue is in the second zero, but works for every other number 1 to 9.

"google-libphonenumber": "3.2.33"

const phoneUtil = require('google-libphonenumber').PhoneNumberUtil.getInstance();

phoneUtil.isValidNumberForRegion(phoneUtil.parse('07700900982', 'GB'), 'GB'); //  =>> false
phoneUtil.isValidNumberForRegion(phoneUtil.parse('07701900982', 'GB'), 'GB'); // =>> true, works with any number 1-9, except 0

phoneUtil.isValidNumberForRegion(phoneUtil.parse('+447700900982', 'GB'), 'GB'); // =>> false
phoneUtil.isValidNumberForRegion(phoneUtil.parse('+447701900982', 'GB'), 'GB'); // =>> true, works with any number 1-9, except 0
phoneUtil.isValidNumberForRegion(phoneUtil.parse('+447702900982', 'GB'), 'GB'); // =>> true
phoneUtil.isValidNumberForRegion(phoneUtil.parse('+447703900982', 'GB'), 'GB'); // =>> true
phoneUtil.isValidNumberForRegion(phoneUtil.parse('+447704900982', 'GB'), 'GB'); // =>> true
phoneUtil.isValidNumberForRegion(phoneUtil.parse('+447705900982', 'GB'), 'GB'); // =>> true
phoneUtil.isValidNumberForRegion(phoneUtil.parse('+447706900982', 'GB'), 'GB'); // =>> true
phoneUtil.isValidNumberForRegion(phoneUtil.parse('+447707900982', 'GB'), 'GB'); // =>> true
phoneUtil.isValidNumberForRegion(phoneUtil.parse('+447708900982', 'GB'), 'GB'); // =>> true
phoneUtil.isValidNumberForRegion(phoneUtil.parse('+447709900982', 'GB'), 'GB'); // =>> true

I am not sure why

Looking at the wikipedia: https://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom
Mobile number format in the UK: 07x xxxx xxxx
Should not be any limitations for number after 07, as soon as you have 11 digits number.

Also, using different internet resource, I have found, that UK mobile/landline number length might be 10 digits:

  • Yes, almost all UK numbers are 11 digits long, including the dialling codes. There are a few areas around the country whose numbers only contain 10 digits, but these are in the minority.
  • Mobile numbers: mobile phone numbers in the UK start with "07" and range from 10-11 digits, though a majority are 11 digits.

You might need to update limitation from 11 to 10 characters, up to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant