v-mask icon indicating copy to clipboard operation
v-mask copied to clipboard

Optional placeholder doesn't work with static characters

Open happyCoda opened this issue 3 years ago • 1 comments

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

codesandbox

Steps to reproduce

  1. For example let's use a phone number in format – (###) ###-####
  2. 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.

happyCoda avatar Oct 20 '20 10:10 happyCoda

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.

arthurshlain avatar Aug 08 '21 21:08 arthurshlain