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.

US phone numbers not passing validation

See original GitHub issue

I’m using chance to build stubs for test cases, and I’m using chance to generate fake user phone numbers. However, I also validate this using libphonenumber and can’t seem to get it to accept any of the numbers generated by chance.phone({country: 'us'}). I also tried using phone and that only accepts half of them. Any idea why this would be?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jtmarmoncommented, Jan 31, 2015

@akre54 my use case is that I have automatic validators in my ORM that format and validate phone numbers before saving. without a valid phone number, none of my test data will save.

0reactions
evanjmgcommented, Sep 5, 2017

+1 also for UK numbers it’s breaking - my work around is while looping it until I get a valid number 😦 - the correct solution would be to use libphonenumberjs

Read more comments on GitHub >

github_iconTop Results From Across the Web

4.2. Validate and Format North American Phone Numbers
Problem. You want to determine whether a user entered a North American phone number, including the local area code, in a common format....
Read more >
Phone Number Validation: Verify Numbers in 3 Seconds
Use our easy-to-use phone number verification tool to expand your contact database and validate phone numbers before you reach out to customers.
Read more >
US Phone Number Verification - Stack Overflow
If your purpose is to guard against mis-entered phone numbers, then you can probably catch well over 90% of them with just a...
Read more >
Phone Validator ✔️ | Is it a Cell or is it a Landline?
Free phone number validation provided by PhoneValidator.com. Check phone numbers to verify if cell phone, landline, VOIP, toll-free or fake.
Read more >
Bad Practices on Phone Number Form Fields - UX Movement
Your users should not wonder which phone number format is valid or get a validation error for the wrong phone number format.
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