1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Why can't I input the last number of the year in an angular-imask component?

Discussão em 'Angular' iniciado por Nelson Teixeira, Setembro 27, 2024.

  1. I'm trying to configure angular-imask for a field, but it won't let me input the last digit in year. It presents the mask correctly and I can type fine but it blocks further typing after 3rd digit. This is the mask I'm using:

    imaskDate = {
    mask: Date,

    pattern: 'd/`m/`Y', // Pattern mask with defined blocks, default is 'd{.}`m{.}`Y'

    blocks: {
    d: {
    mask: IMask.MaskedRange,
    from: 1,
    to: 31,
    maxLength: 2,
    },
    m: {
    mask: IMask.MaskedRange,
    from: 1,
    to: 12,
    maxLength: 2,
    },
    Y: {
    mask: IMask.MaskedRange,
    from: 1900,
    to: 9999,
    }
    },
    lazy: false,
    };


    I couldn't make the code work in code snippet. It's working here:

    https://stackblitz.com/edit/angular-tzovqf

    Anyone knows what's happening here ?

    EDIT

    This is a question that was inactive for 2 1/2 years. I don't remember exactly what was happening at the time and I couldn't reproduce the problem now. I think this may be due to some older browser versions and/or libs. So I can't accept any of the answers.

    Following the advices in this meta question and as this question is receiving answers now, I won't delete it.

    I ask @iateadonut and @abdessamad-aboukdir that answered to please post the environment where this problem is still happening so I can try to reproduce the problem again. Browser version, OS, Angular version and any relevant info.

    I will only accept an answer when someone can provide evidence of how can I create an example of this problem happening or a working example where the problem is occurring. Otherwise it will remain active but unanswered.

    If any moderator thinks I should take any other action, feel free to give any instructions you'd like.

    Continue reading...

Compartilhe esta Página