nyaruka / phonenumbers

GoLang port of Google's libphonenumber library
MIT License
1.25k stars 148 forks source link

unexpected parse behavior #95

Closed zhqu1148980644 closed 3 years ago

zhqu1148980644 commented 3 years ago
ph, err := phonenumbers.Parse("4163020541", "CN")

This code raises no error, though it's obviously not a chinese phone number.

nicpottier commented 3 years ago

Parsing doesn't validate (this is the case with all the APIs upstream as well).

After parsing you want to call IsPossibleNumber or IsValidNumber

zhqu1148980644 commented 3 years ago

@nicpottier IsValidNumber also returns true.

image

rowanseymour commented 3 years ago

According to the upstream library that is correct https://libphonenumber.appspot.com/phonenumberparser?number=4163020541&country=CN. If you believe that is incorrect you should open an issue on https://github.com/google/libphonenumber.

zhqu1148980644 commented 3 years ago

According to the upstream library that is correct https://libphonenumber.appspot.com/phonenumberparser?number=4163020541&country=CN. If you believe that is incorrect you should open an issue on https://github.com/google/libphonenumber.

get it. thanks for your reply.