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

Library incorrectly flagging UAE phone numbers as incorrect #359

Closed
codan84 opened this issue Aug 1, 2023 · 8 comments
Closed

Library incorrectly flagging UAE phone numbers as incorrect #359

codan84 opened this issue Aug 1, 2023 · 8 comments

Comments

@codan84
Copy link

codan84 commented Aug 1, 2023

An example of correct phone number: +97148376525
Output of using phone:

> phone('+97148376525', { validateMobilePrefix: false })
{
  isValid: false,
  phoneNumber: null,
  countryIso2: null,
  countryIso3: null,
  countryCode: null
}
> phone('+97148376525')
{
  isValid: false,
  phoneNumber: null,
  countryIso2: null,
  countryIso3: null,
  countryCode: null
}
> phone('+97148376525', { country: 'ARE', validateMobilePrefix: false })
{
  isValid: false,
  phoneNumber: null,
  countryIso2: null,
  countryIso3: null,
  countryCode: null
}
@codan84
Copy link
Author

codan84 commented Aug 1, 2023

Example using https://www.npmjs.com/package/google-libphonenumber

> const phoneUtil = require('google-libphonenumber').PhoneNumberUtil.getInstance();
undefined
> phoneUtil.isValidNumberForRegion(phoneUtil.parse('+97148376525', 'AE'), 'AE')
true

@Bossa573
Copy link
Member

Bossa573 commented Aug 1, 2023

from the data: https://github.com/AfterShip/phone/blob/master/src/data/country_phone_data.ts#L96C3-L97
the input phone number has to be 9-digit
please include sources that describing precisely about the correct phone number length for UAE phone numbers

@codan84
Copy link
Author

codan84 commented Aug 1, 2023

Data in the link provided must be wrong. The phone number I posted in my initial message is a callable, correct Dubai phone. Go ahead and try it.

@Bossa573
Copy link
Member

Bossa573 commented Aug 2, 2023

The URL above is indeed the source data of this repo.
And also, please provide any proof / website / pdf showing the phone number format guidelines.
It's unable to know the accurate format of the phone number you provide.
And it is not practical to actually try every phone number in the world.

@codan84
Copy link
Author

codan84 commented Aug 2, 2023

@codan84
Copy link
Author

codan84 commented Aug 2, 2023

Furthermore, looking at 800 (NDC), numbers can be between 5 and 12 digits long

@Bossa573
Copy link
Member

Bossa573 commented Aug 2, 2023

The source you are using is outdated.

The source code (https://github.com/AfterShip/phone/blob/master/src/data/country_phone_data.ts#L96C3-L97) would not be proactively updated, by nature eventually it should be outdated, it is the source code, not the "data source" we use 🙂

I will only add "8" to the library at the moment

@Bossa573
Copy link
Member

Bossa573 commented Aug 2, 2023

Further digging out from the wiki page
https://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Arab_Emirates

Landline

0x xxx xxxx (8-digits excluding thunk code 0)

Mobile

05x xxx xxxx (9-digits excluding thunk code 0)


This also align with the data source you provided: https://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000DC0001PDFE.pdf
The phone library only supports mobile phone numbers, not landlines,
we would not include those formats in the library.
(Refer to readme: https://github.com/AfterShip/phone#help)

@Bossa573 Bossa573 closed this as completed Aug 2, 2023
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

2 participants