Closed 360disrupt closed 4 years ago
This library currently doesn't support "dial out codes" as stated in the README.
https://en.wikipedia.org/wiki/List_of_international_call_prefixes
I'm not sure if it should.
Who would need to input a phone number as 00498912196611
instead of +498912196611
.
I think such use-cases are non-existent.
I wouldn't be 100% sure about this I could imagine users typing numbers into forms like they are used to dial them. But the regex replace shouldn't work then, if the prefix isn't 00
everywhere.
I wouldn't be 100% sure about this I could imagine users typing numbers into forms like they are used to dial them
I don't think it would make any sense in a form beause in a form user either enters his local number or his number in international format (+...
).
Anyway, I'm closing this issue for now.
If someone finds a valid use-case where IDD prefix is required then I might consider reopening this issue and adding this feature to the library.
someone finds a valid use-case where IDD prefix is required then I might consider reopening this issue and adding this feature to the library..
For the record, I am using this package (which I am very thankful for) to validate user input phone numbers. I use the parsePhoneNumberFromString
to get the phone number from inside whatever sentence they type. The website is international and we don't ask for the user's country so I cannot set a default country. We noticed that a reasonable amount of users chooses to use 00
instead of +
thus the parsePhoneNumberFromString
fails to recognize the number. The quick solution is to replace the 00
with a +
before parsing, but it would be a nice to have if the library would accept it.
@dcustodio
We noticed that a reasonable amount of users chooses to use 00 instead of +
Oh really? Lol. Okay, I'll reopen this one.
yes, don't ask me why. Maybe they are browsing the website in a mobile and it's easier to press 00
than long-press to get a +
...
@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:
So I guess parsePhoneNumberFromString()
works.
About AsYouType
then.
It doesn't seem to work:
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.
Interestingly, this one turned out to be quite simple.
Released libphonenumber-js@1.7.44
.
Closing.
I don't get the same result/format a number to
E.164
for+49
and0049
?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: