jackocnr / intl-tel-input

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

UK phone numbers wrong validation rules #1629

Closed DanilLiptuga closed 4 months ago

DanilLiptuga commented 4 months ago

Plugin version

v23.0.8

Steps to reproduce

  1. Go to https://intl-tel-input.com/examples/hidden-input.html
  2. Select UK as a country
  3. Enter a 7-digit phone number
  4. Get a validation error

Expected behavior

According to https://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom UK, numbers can be 7 or 9 digits long. But the plugin validation always expects it to be 10 digits long.

Actual behavior

The plugin validation always expects the UK phone number to be 10 digits long.

jackocnr commented 4 months ago

isValidNumber respects the validationNumberType option, which is set to "MOBILE" by default, meaning isValidNumber will only return true for mobile numbers. See the readme on validationNumberType for how to change this behaviour.