jackocnr / intl-tel-input

A JavaScript plugin for entering and validating international telephone numbers. React and Vue components also included.
https://intl-tel-input.com
MIT License
7.69k stars 1.95k forks source link

Problem with phone number from Thailand #1851

Closed Milooz closed 2 weeks ago

Milooz commented 4 weeks ago

Plugin version

e.g. v24.6.0 (please try latest version)

Steps to reproduce

  1. Add a phone number with only 8 numbers and not 9

Expected behaviour

In thailand it's possible to have phone numbers with 8 or 9 numbers

Actual behaviour

You can only add with 9 numbers Example : https://www.hilton.com/en/hotels/bkkhitw-millennium-hilton-bangkok/, only 8 numbers

jackocnr commented 4 weeks ago

We use libphonenumber for formatting, validation and generating placeholder numbers - if your issue relates to one of these things, please check their test site first and if you see the problem there please file an issue with them instead.

If it's working correctly in libphonenumber, the next step is to check that we're using the latest version of libphonenumber in the plugin - check the version history here. If we need to upgrade, it only takes 5 minutes to do this yourself and submit a Pull Request - instructions here: Updating to a new version of libphonenumber.

Milooz commented 3 weeks ago

Thank you for your answer. I check libphonenumber

Milooz commented 3 weeks ago

I just test on their demo page Phone Number Parser Demo with this number (+66 2636 1950) and it works.

I'm using this link to load your library intel-tel-input but it's not working.

However, you seem to be using the correct version of their library. I'm a little lost

ZoTyA1975 commented 2 weeks ago

The same is the case with Hungarian phone numbers (sorry for not opening a separate error ticket, but this seems to be the same error). In Hungary, you can also have 8- and 9-digit phone numbers (Budapest landline numbers are 8-digit, e.g. +36-1-234-5678). I get the same error for these (the Phone Number Parser Demo page also indicates these phone numbers as valid).

jackocnr commented 2 weeks ago

@Milooz @ZoTyA1975 what exactly is the problem here? Is it that you're using a validation method and it's failing? Which validation method are you using?

ZoTyA1975 commented 2 weeks ago

On this page: https://intl-tel-input.com/examples/validation-practical.html, enter this phone number (select Hungary): 12345678 Then on this page: https://htmlpreview.github.io/?https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/demo-compiled.html enter this number: +3612345678 (same number as on the previous page) This phone number is a valid Hungarian phone number.

ZoTyA1975 commented 2 weeks ago

I think I found the solution to my problem. I have to use this: https://intl-tel-input.com/examples/validation.html

jackocnr commented 2 weeks ago

On https://intl-tel-input.com/examples/validation-practical.html if you read the line of text above the input, it says:

NOTE: by default, isValidNumber only returns true for mobile numbers. See validationNumberType option for more information.

I'm guessing this number (+3612345678) is not a mobile number?

If you want to accept all numbers instead of just mobile numbers, you can set validationNumberType=null

Milooz commented 2 weeks ago

On https://intl-tel-input.com/examples/validation-practical.html if you read the line of text above the input, it says:

NOTE: by default, isValidNumber only returns true for mobile numbers. See validationNumberType option for more information.

I'm guessing this number (+3612345678) is not a mobile number?

If you want to accept all numbers instead of just mobile numbers, you can set validationNumberType=null

Oh thank you for your answer!!! It was exactly this problem! Sorry for the inconvenience

jackocnr commented 2 weeks ago

(at some point I will try to make the demo page more clear around this issue as it is a bit confusing)