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

? Optional Character Adding Additional Character

Open gabbibrooks opened this issue 5 years ago • 7 comments

V-Mask and Vue versions

2.0.2, 2.6.10

Reproduction Link

https://jsfiddle.net/a07teqLf/1/

Steps to reproduce

  1. Enter '1/9/2020' into the text field with mask value of '#?#/#?#/####'
  2. Observe additional '/' being added after / is typed.

What is Expected?

I would expect based on the documentation that it would format to 1/9/2020

What is actually happening?

1//9//2020 is the masked value.

I dont know if this is intended functionality but it doesn't seem to allow a date format from the ##/##/#### mask value.

gabbibrooks avatar Jan 09 '20 22:01 gabbibrooks

Same here.

Is theree some workaround? please, help!

2020-07-28 (2)

haiarha avatar Jul 28 '20 07:07 haiarha

Same here...

ux-engineer avatar Feb 03 '21 19:02 ux-engineer

Is this same issue? https://github.com/probil/v-mask/issues/503

ux-engineer avatar Feb 03 '21 19:02 ux-engineer

Also tried to use [/\d/, /\d?/, /\./, /\d/, /\d?/, /\./, /\d/, /\d/, /\d/, /\d/] to achieve mask pattern '#?#.#?#.####'.

However, trying to input '1.12.2022' resulted in '1..12.2022'

ux-engineer avatar Feb 03 '21 19:02 ux-engineer

@probil any chances you would have time to look for a bug fix for this?

It seems possible you could close several issues with one fix, as this issue with Regex pattern array resulted in similar misbehavior with static characters :)

ux-engineer avatar Feb 03 '21 19:02 ux-engineer

Just wanted to comment and say that this is till an issue on version 2.2.4.

I'm was trying to create a temperature mask (##?#.#) so that a user could either type in 1000 and get 100.0 or if they were to type 98.6 they would get 98.6. However, when typing 98.6 I ended up with 98..6

dan-whitehouse avatar Mar 10 '21 02:03 dan-whitehouse

As a workaround (maybe not the best), add your v-model to a watch and remove the extra dot:

watch: { vmodel: function() { this.vmodel.replace("..","."); } }

justinbeatz avatar Jul 02 '21 18:07 justinbeatz