Unexpected AsYouType result with certain country codes (VI, BS)
See original GitHub issueI believe I have found an issue with the AsYouType feature. With the country code ‘VI’ (US Virgin Islands) or ‘BS’ (Bahamas), the input method returns unexpected values with partial phone numbers:
var asYouType = new libphonenumber.AsYouType('VI');
console.log(asYouType.input('(340) 693')); // (340) 693
asYouType.reset();
//***********These don't format correctly*************
console.log(asYouType.input('(340) 6934')); // 1 (340) 340-6934
asYouType.reset();
console.log(asYouType.input('3406934')); // 1 (340) 340-6934
asYouType.reset();
//*****************************************************
console.log(asYouType.input('(340) 69348')); // (340) 693-48
asYouType.reset();
console.log(asYouType.input('(340) 693480')); // (340) 693-48
asYouType.reset();
console.log(asYouType.input('(340) 6934800')); // (340) 693-4800
asYouType.reset();
You can see it happening in this fiddle: https://jsfiddle.net/1vptu0ad/2/
Interestingly, the issue does not happen in the demo here: https://catamphetamine.github.io/libphonenumber-js/
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Access Control Rules: URL Filtering - Configuration Guides
The list updates as you type to display matching categories. Tip. You can add a maximum of 50 items to the Selected URLs...
Read more >Help - PubMed - NIH
How do I find a specific citation? I have some information such as the author, journal name, and publication year.
Read more >Country Codes List - Nations Online Project
Afghanistan AF AFG 004
Aland Islands AX ALA 248
Albania AL ALB 008
Algeria DZ DZA 012
Read more >Frequently Asked Questions - Harvard College
How familiar is the Admissions Committee with secondary schools? Their rigor? What marks mean in a particular school or educational system?
Read more >Migrating to 8.0 | Elasticsearch Guide [8.5] | Elastic
Settings used to defer cluster recovery pending a certain number of master ... Indices created in Elasticsearch 6.x and earlier versions are not...
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
To whoever comes here: I still haven’t looked into the issue and currently I’m having a bit of busy days + it’s Summer. But eventually I’ll look into this issue and compare this library’s code with Google’s code to see where’s the difference.
@dmitry-salnikov
I guess I’ll prioritize this one. It has really been a long time. I’ll see if I can start this one before Christmas.