Imask replaces Y with 2 when the from is from 2000

24 Views Asked by At

I am trying to mask MM/DD/YYYY format for calendar using angular-imask. When I have the from as 2024 instead of displaying MM/DD/YYYY as placeholder it is displaying MM/DD/2YYY. Is there a way to always display MM/DD/YYYY irrespective of what is passed in from?

{
      mask: pattern,
      lazy: false,
      blocks: {
        YY: {
          mask: IMask.MaskedRange,
          placeholderChar: 'Y',
          from: 24,
          to: 99
        },

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

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

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

Masked date format when I pass the from as 2024

0

There are 0 best solutions below