goveo / react-international-phone

☎️ International phone input component for React
https://react-international-phone.vercel.app/
MIT License
277 stars 54 forks source link

Format number for The Netherlands #185

Closed jessetan closed 4 months ago

jessetan commented 4 months ago

What has been done

The default formatting for phone number from the Netherlands used the format .. ......... That is, a two digit area code followed by the rest of the number.

However area codes can be either two or three digits (plus one if you count the optional 0 which should be omitted in E.164 notation). A full list from the Dutch government is here: https://wetten.overheid.nl/jci1.3:c:BWBR0010198&bijlage=1&z=2022-12-16&g=2022-12-16 The majority of the area codes are three digits and a smaller number have two digits. Notable exceptions are mobile numbers, which always start with 6.

This PR adds formatting for all one and two digit area codes, as well as one, two and three digit area codes with the optional leading 0. If no area code matches, it is assumed to be a three digit area code without leading 0.

Checklist before requesting a review

Screenshots (if appropriate):

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-international-phone-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 18, 2024 2:25pm
react-international-phone-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 18, 2024 2:25pm
goveo commented 4 months ago

:tada: This PR is included in version 4.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

ThulinaWickramasinghe commented 2 weeks ago

Hi @jessetan!

I'm facing an issue with validating numbers starting from '097'. We're using your phone input to get OTPs and we have users worldwide. But due to formatting numbers like this (+31 97010290042) are not allowed. Disabling formatting doesn't help as well since still number length is validated.

It is said that these numbers are M2M numbers but there are mentions of numbers like the following which say these are being used to get SMS.

https://issuetracker.google.com/issues/74493346#comment6