Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"1-707-975-3864 x110" is not a valid phone number #393

Closed
RwSgxx opened this issue Sep 26, 2021 · 1 comment
Closed

"1-707-975-3864 x110" is not a valid phone number #393

RwSgxx opened this issue Sep 26, 2021 · 1 comment
Labels
gotcha issues that new users encounter that should be looked at to improve new user experience invalid question wontfix

Comments

@RwSgxx
Copy link

RwSgxx commented Sep 26, 2021

Version Information

Software Version(s)
Bogus NuGet Package 33.1.1
.NET Core? .Net5
.NET Full Framework?
Windows OS? 10 UpToDate
Linux OS?
Visual Studio? 2019 -> 16.11.3

What locale are you using with Bogus?

default

What is the expected behavior?

Generate normal phone numbers that are also parsable by google phone lib.

What is the actual behavior?

It generates phone numbers like: "1-707-975-3864 x110". I've never seen a number like that, and is not parsable by google phone lib.

Please provide a stack trace.


Any possible solutions?

How do you reproduce the issue?

Everything default
Ask for a phone number.

Do you have a unit test that can demonstrate the bug?

no

Can you identify the location in Bogus' source code where the problem exists?

no

If the bug is confirmed, would you be willing to submit a PR?

no

Yes or No?

@bchavez
Copy link
Owner

bchavez commented Sep 26, 2021

Hello, the format is a phone number with an extension.

"!##-!##-#### x###",
"(!##) !##-#### x###",
"1-!##-!##-#### x###",
"!##.!##.#### x###",
"!##-!##-#### x####",
"(!##) !##-#### x####",
"1-!##-!##-#### x####",
"!##.!##.#### x####",
"!##-!##-#### x#####",
"(!##) !##-#### x#####",
"1-!##-!##-#### x#####",
"!##.!##.#### x#####"

If you don't want phone numbers with an extension, use the .PhoneNumberFormat(_) method with the appropriate format you'd like. Eg. Index 1 is this format:

"(!##) !##-####",

   var f = new Faker();
   f.Phone.PhoneNumberFormat(1)
          .Dump();
(250) 824-1596

Or specify your own:

f.Phone.PhoneNumber("###.!##.####").Dump();
865.390.9546

Thanks,
Brian

@bchavez bchavez closed this as completed Sep 26, 2021
@bchavez bchavez added gotcha issues that new users encounter that should be looked at to improve new user experience invalid question wontfix labels Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gotcha issues that new users encounter that should be looked at to improve new user experience invalid question wontfix
Projects
None yet
Development

No branches or pull requests

2 participants