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

Error during the phone number validation for Japan. #1745

Closed arthutox closed 3 months ago

arthutox commented 3 months ago

Plugin version v23.8.1

Steps to reproduce

  1. https://intl-tel-input.com/examples/validation-practical.html pls try to paste valid Japan phone number - +81 3 3523 0811 Screenshot 2024-08-13 at 17 19 20

When validating the number, an error is returned because the plugin considers it invalid. I checked this number in the libphonenumber. Result from isValidNumber() | true

Screenshot 2024-08-13 at 17 22 13

https://libphonenumber.appspot.com/phonenumberparser?number=%2B81+3+3523+0811

Expected behaviour The plugin's response to the valid number check is true.

Actual behaviour The plugin's response to the valid number check is false.

Initialisation options

List any options you're using e.g. utilsScript or onlyCountries

jackocnr commented 3 months ago

As per the instructions in your screenshot, by default, isValidNumber only returns true for mobile numbers. If you want it to accept other kinds of numbers, you need to also set validationNumberType accordingly (see readme).