1

How to add a trailing dot to Cleave.js date pattern (DD.MM.YYYY.)?

So valid input would be: 04.05.2023.

new Cleave('.my-input', {
    date: true,
    datePattern: ['Y', 'm', 'd'],
    delimiter: '.'
});


// outputs: DD.MM.YYYY - without the final dot
davidm
  • 1,570
  • 11
  • 24

2 Answers2

0

I don't think this is possible with only cleave.js.

0

Add a '.' to the end of datePattern.

 new Cleave('.my-input', {
        date: true,
        datePattern: ['D', 'M', 'Y', '.'],
        delimiter: '.'
    });
Ujjawal Kumar
  • 300
  • 1
  • 2
  • 12