dongri / phonenumber

With a given country and phone number, validate and format the MOBILE phone number to E.164 standard
MIT License
186 stars 46 forks source link

Digit validation #12

Closed vasundhara785 closed 3 years ago

vasundhara785 commented 3 years ago

1.It is giving the country code even if the number contains alphanumeric characters 2.Some countries validations are missed due to length/prefix mismatch.

Thanks.

dongri commented 3 years ago

@vasundhara785 Can you give me a sample number?

vasundhara785 commented 3 years ago

@dongri 62895349866066 (Indonesia number)

For the indonesia number below iso code

i.PhoneNumberLengths = []int{9, 10, 11}

dongri commented 3 years ago

@vasundhara785 Indonesia phone number length fixed.

vasundhara785 commented 3 years ago

@dongri

Can i know on what basis the length validation / prefix is being done?

dongri commented 3 years ago

https://en.wikipedia.org/wiki/E.164 https://en.wikipedia.org/wiki/List_of_country_calling_codes

vasundhara785 commented 3 years ago

@dongri How to differentiate between singapore numbers (65XXXXXXXX) and india numbers with(65XXXXXXXX)?

dongri commented 3 years ago

https://github.com/dongri/phonenumber/blob/master/iso3166.go#L791-L795 India is "91" https://en.wikipedia.org/wiki/Telephone_numbers_in_India

vasundhara785 commented 3 years ago

No if the user doesn't specify "91" for india numbers. How to differentiate india number without specifying "91" country code (India number starting with "65") and singapore number having country code "65".

dongri commented 3 years ago

That's impossible... Please add the country code.