Andrew Baker
Andrew Baker

Reputation: 191

Why are Indian phone numbers automatically prepending a 0 in Maz-UI

I am using Vuejs's Maz-UI framework, and specifically their phone number inputter.

But there is an issue; when selecting Indian phone numbers, I type in some random 10 digit string of numbers.

But instead of showing the (formatted) phone number on screen, it adds a 0 to the front of the input.

Here's an example:

This is the expected result:

This is the actual result:

Sorry for not taking a screenshot for the expected result; when I tried to take it, it automatically re-formatted it the wrong way.

Does anyone know why this occurs? I don't think this is the correct formatting of Indian numbers.

Upvotes: 2

Views: 148

Answers (1)

Lucas Mendonca
Lucas Mendonca

Reputation: 436

It seems that the library is using libphonenumber-js's national formatting which adds the leading zero to your phone number. You can play with the demo here: https://catamphetamine.github.io/libphonenumber-js/?parseCountry=IN&parseValue=1234567890

You may want to use international formatting instead (see the demo above)

Upvotes: 0

Related Questions