parsePhoneNumberFromString() returns undefined with "+0" number prefix.
See original GitHub issueCalling parsePhoneNumberFromString("+0407123456", "AU")
returns the value undefined
.
This is caused by extractCountryCallingCode() on parse_.js line
// Fast abortion: country codes do not begin with a '0'
if (number[1] === '0')
{
return {} // returns by extractCountryCallingCode()
}
let { countryCallingCode, number } = extractCountryCallingCode(formatted_phone_number, default_country, metadata.metadata)
So countryCallingCode
and number
are now both undefined.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
libphonenumber-js - npm
Returns an instance of PhoneNumber class, or undefined if no phone number could be parsed: for example, when the string contains no phone...
Read more >How to output numbers with leading zeros in JavaScript?
Is there a way to prepend leading zeros to numbers so that it results in a string of fixed length? For example, 5...
Read more >Frequently Asked Questions (FAQ)
If the number is too short to be a valid phone number in this country, we do not remove the national prefix. For...
Read more >Leading zero - Wikipedia
A leading zero is any 0 digit that comes before the first nonzero digit in a number string in positional notation. For example,...
Read more >Using libphonenumber for International Phone Numbers
Libphonenumber is Google's formatting, parsing, and validation tool for international phone numbers. Learn how to use it in your global apps ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No, that’s a perfectly correct API interface and only weird code needs to hack around that.
Ok that’s a weird API interface but I can hack around it. Thanks.