jackocnr / intl-tel-input

A JavaScript plugin for entering and validating international telephone numbers
https://intl-tel-input.com
MIT License
7.38k stars 1.93k forks source link

Validation doesn't work for some phone numbers from Germany #1615

Closed impratick closed 2 months ago

impratick commented 2 months ago

Plugin version

v23.0.4

Steps to reproduce

  1. Select Germany(+49) as country code
  2. Enter 0XXXXXXXXX or +49XXXXXXXXX as the phone number

Expected behavior

It should be identified as a valid phone number.

Actual behavior

Being identified as an invalid phone number, however, it is valid. Tested on validation-practical demo

Update: 14.05.2024

You can try any German 7-digit phone number.

jackocnr commented 2 months ago

The problem is that the number is a FIXED_LINE number and isValidNumber respects the validationNumberType option, which is MOBILE by default. If you need to accept other number types, you can change this option to null. Or alternatively, use isValidNumberPrecise (demo here), which I checked and it passes for this number.

impratick commented 2 months ago

Yes, I think this will help me. Thanks @jackocnr.