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

parsePhoneNumber response marked as invalid #98

Closed
j-christoffersen opened this issue Mar 13, 2023 · 4 comments · May be fixed by ultar1/raganork-md#1
Closed

parsePhoneNumber response marked as invalid #98

j-christoffersen opened this issue Mar 13, 2023 · 4 comments · May be fixed by ultar1/raganork-md#1

Comments

@j-christoffersen
Copy link

Version: 5.2.0

Running the following gives an invalid and presumably incorrect result

parsePhoneNumber("0740521234", { regionCode: "US" })

This is the result:

{
  number: {
    input: '0740521234',
    international: '+1 0740521234',
    national: '0740521234',
    e164: '+10740521234',
    rfc3966: 'tel:+1-0740521234',
    significant: '0740521234'
  },
  regionCode: 'US',
  valid: false,
  possible: true,
  canBeInternationallyDialled: true,
  type: 'unknown',
  possibility: 'is-possible',
  typeIsMobile: false,
  typeIsFixedLine: false,
  countryCode: 1
}

Seems like valid should be true here, but regardless the shape of the response is neither ParsedPhoneNumberValid nor ParsedPhoneNumberInvalid as defined in the readme

@grantila
Copy link
Owner

grantila commented Apr 2, 2023

Fixed in 5.3.0

@timm-stelzer-e-farm
Copy link

Regression in 5.10.0, same input and incorrect result as OP.

@grantila
Copy link
Owner

grantila commented Jul 7, 2023

This is not a valid US phone number, is it?

@timm-stelzer-e-farm
Copy link

True, numbers can't lead with a 0. My bad, I assumed if valid===false, we don't get the other fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants