uNmAnNeR / imaskjs

vanilla javascript input mask

Home Page:https://imask.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

when the min year is 2024 or anything greater than 1999, first character is 2, instead of Y

pruthvi224 opened this issue · comments

Describe the bug
A clear and concise description of what the bug is. Is it related to core functionality or plugin to some framework.

To Reproduce
{
mask: pattern,
lazy: false,
blocks: {
YY: {
mask: IMask.MaskedRange,
placeholderChar: 'Y',
from: minYear - 2000,
to: 99
},

    YYYY: {
      mask: IMask.MaskedRange,
      placeholderChar: 'Y',
      from: 2000,
      to: 2100
    },

    DD: {
      mask: IMask.MaskedRange,
      placeholderChar: 'D',
      from: 1,
      to: 31
    },

    MM: {
      mask: IMask.MaskedRange,
      placeholderChar: 'M',
      from: 1,
      to: 12
    },
  }
}

Expected behavior
when the from is > 2000, the placeholder character should always be YYYY not 2YYYY

Environment:

  • Browser chrome
  • IMask version : 7.1.3

hi, placeholder is used for positions that accept input. In your case the only possible value for first digit in the year is 2 and nothing else. So it was replaced with 2. In my opinion it makes sense and should work as it is now. It's possible to have a placeholder you expect using a dynamic mask for the year block. It's not an easy case but you can find some examples in the doc to help.