AfterShip / phone

With a given country and phone number, validate and reformat the mobile phone number to the E.164 standard. The purpose of this is to allow us to send SMS to mobile phones only.
https://www.aftership.com
MIT License
851 stars 269 forks source link

Does not correctly parse Zimbabwe numbers +263 #350

Closed rayteale closed 1 year ago

rayteale commented 1 year ago

Version 3.1.31

Does not seem to recognise valid Zimbabwe numbers.

  1. Cresta Hotel in Harare +263 24 2772633 : { isValid: false, phoneNumber: null, countryIso2: null, countryIso3: null, countryCode: null }

  2. By contrast Mojo Hotel in Cape Town +27 87 940 7474 : { isValid: true, phoneNumber: '+27879407474', countryIso2: 'ZA', countryIso3: 'ZAF', countryCode: '+27' }

Bossa573 commented 1 year ago

note that the library cannot detect landline phone numbers properly. https://github.com/AfterShip/phone#faq thank you very much

rayteale commented 1 year ago

Not just landline numbers. Also fails with eSim mobile numbers. i havent tested with other Zim mobiles.

Bossa573 commented 1 year ago

Can you provide the precise correct format (and the prove showing those are the correct mobile phone number format)?

Bossa573 commented 1 year ago

Format refering to https://github.com/AfterShip/phone/blob/master/src/data/country_phone_data.ts#L1896

mainly about phone number prefix and the phone number length

rayteale commented 1 year ago

My customer complained with a number [+263 78 589 xxxx]. Apparently this is an eSim number in Zimbabwe. My application is for mobiles only. Perhaps they have recently added 78 to mobile area codes. Unfortunately I am not in that country so cant test at all. (I can confirm that it works with other mobiles).

rayteale commented 1 year ago

Apparently 78 is valid mobile for Zimbabwe - according to Wikipedia. Econet Wireless Zimbabwe. See "How to call a Zimbabwe mobile phone number" on this page https://en.wikipedia.org/wiki/Telephone_numbers_in_Zimbabwe

Bossa573 commented 1 year ago

I'll add 78 to it in the next release

Bossa573 commented 1 year ago

https://github.com/AfterShip/phone/releases/tag/3.1.37 https://www.npmjs.com/package/phone/v/3.1.37