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

customMask for phone numbers prefixed with a zero #67

Open
Bilal-Abdeen opened this issue Mar 6, 2024 · 1 comment
Open

customMask for phone numbers prefixed with a zero #67

Bilal-Abdeen opened this issue Mar 6, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Bilal-Abdeen
Copy link

Thank you for the excellent library.

I wonder if it is at all possible to add a customMask that allows phone numbers with and without a prefix of a zero? I tried the following but it did NOT work. It seems that the library's mask can only separate digits with spaces. It would be great if it could consider the value entered.

customMask={[ "4## ### ###", "04## ### ###", ]} 

The above mask should allow ONLY: "04## ### ###" and "4## ### ###"
However, it allows "### ### ###" and "#### ### ###"

Background:
In some countries, calling a local mobile phone number requires the use of a zero before the phone number. For example, in Australia, to call a mobile phone number I need to dial 04## ### ###. While some users realise that they should enter the number without prefixing it with zero, some don't. My code removes the zero before saving it to the db.

@AstrOOnauta AstrOOnauta added the enhancement New feature or request label Mar 19, 2024
@PPHelios
Copy link

I'm facing same issue, even after adding a description many people just add the zero, I made a work around by adding an extra mask for a list of countries I'm facing issue with, then validates the output before submitting and removing the 0 if the country code matches a number in this list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants