v-mask
v-mask copied to clipboard
Optional placeholder doesn't work with static characters
When using optional placeholder – ? in masks it can only work with placeholders – #, N, etc. and not with static characters.
V-Mask and Vue versions
2.2.3, 2.6.11
Reproduction Link
Steps to reproduce
- For example let's use a phone number in format – (###) ###-####
- Make dash optional (###) ###?-####
What is Expected?
Phones like 9999999999 will be formatted as (999) 9999999 and phones like 999999-9999 became - (999) 999-9999
What is actually happening?
Any phone became – (999) 999 so everything goes after the question mark (in pattern) just cuts off.
Same issue, but i'm trying to make optional +
sign in phone number.
Nothing happens on type with value ?+# ### ###-##-##
I also trying to make function that check first +
character, but array implementation looks as something wrong.
(Why it's not possible to return string of placeholders from function?)
Maybe more specific plugin is needed to support phone numbers masking.