webcat12345 / ngx-intl-tel-input

Phone number input field to support international numbers, Angular
MIT License
213 stars 339 forks source link

Bug on France number in 07 xx xx xx xx #230

Closed gign0766 closed 4 years ago

gign0766 commented 4 years ago

Hi, I found an issue on French phone numbers. When I try to enter a number like +33 7 xx xx xx xx, the form is invalid, but this is a valid french mobile number.

image

gign0766 commented 4 years ago

I'm on Angular 8, with the following dependencies for the package :

"google-libphonenumber": "^3.2.2", "hammerjs": "^2.0.8", "intl-tel-input": "^15.1.2", "ngx-intl-tel-input": "^2.3.1",

larabirabert commented 4 years ago

+1

pasevin commented 4 years ago

Are you sure this is not google-libphonenumber specific issue?

larabirabert commented 4 years ago

no it's not google-libphonenumber because I don't use it I use only your component.

pasevin commented 4 years ago

@larabirabert it's impossible because google-libphonenumber is the dependency for this library. We are just the wrapper for angular.

You can see here: https://libphonenumber.appspot.com/phonenumberparser?number=701020304&country=FR

This is what google-libphonenumber returns:

Validation Results
Result from isPossibleNumber()  true
Result from isValidNumber() false
Phone Number region FR
Result from getNumberType() UNKNOWN
pasevin commented 4 years ago

Closing this as this is definitely google-libphonenumber related.

larabirabert commented 4 years ago

Ok I understand, we make a workaround in our application but can you do a work around in your component ?

pasevin commented 4 years ago

@larabirabert what do you mean by workaround? As I understand the number +33 7 01 02 03 04 is not valid. It is just isPossibleNumber, which means:

quickly guessing whether a number is a possible phonenumber by using only the length information, much faster than a full validation.

Are you suggesting adding optional parameter which would override "full" validation, in favor of only length check?

like: [validationType]=ValidationType.Full or [validationType]=ValidationType.Length

If so, then please create a new issue as a feature request.

larabirabert commented 4 years ago

this number is valid in France it’s new since 2010

Before 2010 it’s was not valid it’s started only with 06 and 8 numbers Since 2010 it’s 06 or 07 and 8 numbers

pasevin commented 4 years ago

Ok, this is interesting.

I tried this other more up to date library which was proposed to be used instead of current google-libphonenumber.

Here is a demo I found. It looks like this lib properly validates these new French numbers. Can you confirm that? Maybe then we can try to replace this library with the aforementioned.

larabirabert commented 4 years ago

I have tested it on your demo link it works fine for + 33 6 and 8 numbers and + 33 7 and 8 numbers

pasevin commented 4 years ago

Strange, because, the original demo page: https://catamphetamine.gitlab.io/libphonenumber-js/ has the same valid: False result...

pasevin commented 4 years ago

I'm kind of lost on this one to be honest, everywhere I try to validate this number +33701020304 it comes up as false. Do you have any examples online where this numbers validates as correct?

larabirabert commented 4 years ago

Your right I am wrong +33 7 50 02 03 04 is valid +33 7 01 02 03 04 is not valid as I can read in wikipedia : https://fr.wikipedia.org/wiki/Liste_des_pr%C3%A9fixes_des_op%C3%A9rateurs_de_t%C3%A9l%C3%A9phonie_mobile_en_France It should start with 075 or 076 or 078 or 079 but not 070

So it's not a bug

pasevin commented 4 years ago

Ok, then I'm closing this.