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.

Unexpected AsYouType result with certain country codes (VI, BS)

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
catamphetaminecommented, Jun 17, 2019

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.

1reaction
catamphetaminecommented, Dec 16, 2019

@dmitry-salnikov

Any news on that?

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.

Read more comments on GitHub >

github_iconTop 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 >

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