catamphetamine / libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript
https://catamphetamine.gitlab.io/libphonenumber-js/
MIT License
2.76k stars 218 forks source link

Belgium phone number are valid even if they can't be parsed for national display #435

Open YonniRouelle opened 1 year ago

YonniRouelle commented 1 year ago

When I tried to parse belgium phone numbers

const newPhoneNumber = parsePhoneNumberFromString(
    '047501020',
    'BE'
);

console.log(newPhoneNumber?.isValid()); // true

const newPhoneNumber = parsePhoneNumberFromString(
    '0475010203',
    'BE'
);

console.log(newPhoneNumber?.isValid()); // true

Two cases are returning true whereas in the first case 1 digit is missing to be valid.

I tried same thing with French and when 1 digit is missing, the isValid method return false.

catamphetamine commented 1 year ago

See https://github.com/catamphetamine/libphonenumber-js#bug-reporting