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

Brazilian numer is formating national code without parenthesis #1627

Closed sciotta closed 1 month ago

sciotta commented 1 month ago

Plugin version

v23.0.7

Steps to reproduce

  1. Choose Brazil
  2. Note the place holder displaying "(11) 96123-4567"
  3. Enter 12936180822

Expected behaviour

Number must be formatted like "(12) 93618-0822"

Actual behaviour

Number formated as "12 93618-0822"

Initialisation options

strictMode: true formatAsYouType: true nationalMode: true *I tried otherwise too

jackocnr commented 1 month ago

Yes I agree this is inconsistent and not ideal. We use libphonenumber for generating (and formatting) the placeholder numbers, as well as for the as-you-type formatting. Here you can see the libphonenumber output for that phone number - the national formatting is "(11) 96123-4567" but annoyingly the as-you-type formatter seems to return it in international format: "11 96123-4567". You're welcome to file an issue with libphonenumber if you want. Ideally, the as-you-type formatter would have a way of specifying which format you want. I'll close this issue for now, as there's nothing we can do until they change it upstream.