uNmAnNeR / imaskjs

vanilla javascript input mask

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Date] Handle pattern with single day or month (d-M-yyyy)

VadymLeonov opened this issue · comments

Describe the bug
Hello, I have faced an issue with pattern d-M-yyyy. My blocks for this format looks like:
image

Placeholder looks correct,
image
but when i place focus to input i see:
image
and it doesnt accept '01' (i can enter 01, but at the end i can't enter last char of year, with pattern dd/mm/yyyy it works correct).

Could you please advise how to handle such formats (where can be placed 1 to 12, but not 01)?

hi @VadymLeonov,
you can't enter the last digit because you didn't read the docs before using the tool: https://imask.js.org/guide.html#masked-date

placeholder generated by imask has one char for each required symbol. It can be changed by using dynamic mask for example but it requires low-level customization of pattern mask. I don't think it's possible with simple Date mask.