question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Leading Double 00 in Country Code

See original GitHub issue
libphonenumber-js: v 1.0.24
node v7.10.1

I don’t get the same result/format a number to E.164 for +49 and 0049?

libphonenumber.parse( '0049(89) 11196611' ) //returns {}
libphonenumber.parse( '0049(89) 11196611' , 'DE') //returns {}
new libphonenumber.AsYouType('DE').input('0049(89) 11196611') //'00498912196611'
libphonenumber.parse( '0049(89) 11196611' ) //returns {}
libphonenumber.parse( '0049(89) 11196611' , 'DE') //returns {}
new libphonenumber.AsYouType('DE').input('0049(89) 11196611') //'00498912196611'

The same number libphonenumber.appspot.com Is correctly trnaformed to E.164

Is there are reason why a leading 00 is not equal to a +? Or can it be safely tranformed:

let tel =  '0049(89) 11196611'.replace(/^00/, '+')
let parsedNumber = libphonenumber.parse(tel)
if (parsedNumber.phone)
  libphonenumber.format(parsedNumber.phone,  parsedNumber.country, 'E.164')

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
catamphetaminecommented, Feb 18, 2020

Interestingly, this one turned out to be quite simple. Released libphonenumber-js@1.7.44. Closing.

0reactions
catamphetaminecommented, Feb 18, 2020

@360disrupt Let’s start with your case. You seem to have reported it a long time ago, and the issue seems to have been fixed since then:

Demo result:

image

Google’s demo result

So I guess parsePhoneNumberFromString() works.

About AsYouType then. It doesn’t seem to work:

image

I’ll see if that could be fixed.

Now, @dcustodio 's case. Provide an exact case when the library’s parsePhoneNumberFromString result differs from Google’s demo result. P.S.: for searching multiple numbers in text use findPhoneNumbersInText() function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

00 is which country mobile number code? - Quora
Most countries use 00 as their international access code, though there are others like 011, ... Can same mobile number be issued to...
Read more >
International Country Calling Codes and Dialing Prefixes
Ecuador 593 00 Egypt 20 00 El Salvador 503 00 Equatorial Guinea 240 00
Read more >
International Calling Codes | Telephone Country Codes List
Dial the IDD, which for majority of the world is 00 or 011. Add the country code from the country code list. Then...
Read more >
International Calling Codes | Country Code Search
Country, Territory or Service Areas Country Calling Codes Time Zone DST Abkhazia +7 840, +7 940 UTC+03:00 Afghanistan +93 UTC+04:30 Åland Islands +358 18 UTC+02:00 UTC+03:00...
Read more >
Leading zero after country code is seen as valid
In Germany (and e.g. UK), if you start with a country code, you leave the 0 out after the country code so the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found