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

Update metadata for support Pakistan 326 codes #113

Open
aikikode opened this issue May 2, 2022 · 0 comments
Open

Update metadata for support Pakistan 326 codes #113

aikikode opened this issue May 2, 2022 · 0 comments

Comments

@aikikode
Copy link

aikikode commented May 2, 2022

This library has the same issue as nyaruka/phonenumbers#110: due to outdated metadata Pakistan mobile phone matching pattern is

national_number_pattern:"3(?:[014]\\d|2[0-5]|3[0-7]|55|64)\\d{7}" possible_length:10 example_number:"3012345678"

That only includes codes 320-325, while 326 is also a valid one.

The code:

package main

import (
    "fmt"
    "github.com/ttacon/libphonenumber"
)

func main() {
    parsedPhoneNumber, _ := libphonenumber.Parse("0325-0000000", "PK")
    fmt.Println(parsedPhoneNumber, libphonenumber.IsValidNumber(parsedPhoneNumber))
    parsedPhoneNumber, _ = libphonenumber.Parse("0326-0000000", "PK")
    fmt.Println(parsedPhoneNumber, libphonenumber.IsValidNumber(parsedPhoneNumber))
}

Provides:

country_code:92 national_number:3250000000  true
country_code:92 national_number:3260000000  false // should be true
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

No branches or pull requests

1 participant