Inconsistency between isValidNumber and the valid property of asYouType
See original GitHub issueHey!
First of all thank you for providing this alternative to the official library provided by Google.
isValidNumber()
returns true
for the invalid german phone number ‘123456’ while the valid
property of asYouType
returns false
as expected/desired. isValidNumber()
uses parse()
internally which strips the national prefix.
If this behavior is desired then I believe it must be documented more clearly in the README.md.
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Google-libphonenumber: Parse, format, Store and Validate ...
The "As You Type" formatter is a specialized tool that show the formatting progress as it attempts to discover the right format for...
Read more >react-phonenr-input - UNPKG
'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf....
Read more >javascript - Getting true valid number using asYouType in ...
I'm using libphonenumber in react to format and validate phone number (Lebanese number in my case). The valid mask of the Lebanese phone...
Read more >How to use the libphonenumber-js.isValidNumber function in ...
setState({submitAttempted: true, isError: true}); if (allowSMS && isValidNumber(recipient, country)) { sendToGA("event", { eventCategory: "SMS Modal ...
Read more >Updated phone formatter (#241) · 6e86c48486 - ocsms - Gitea
lib/vendor/giggsey/libphonenumber-for-php/src/Leniency/Valid.php ... `isValidNumber` - full validation of a phone number for a region using length and ...
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
Ok, so I guess it should be
false
. Seems thatisValidNumber
currently only validates the national number and doesn’t check the national prefix. I’ll add that check.Due to a recent issue I’m reverting this fix https://github.com/halt-hammerzeit/libphonenumber-js/issues/67
“As you type” now no longer provides validation. And
30123456
is considered valid by the official Google demo: https://libphonenumber.appspot.com/phonenumberparser?number=30123456&country=DE