skip to Main Content

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

2

Answers


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

    Login or Signup to reply.
  2. Add a '.' to the end of datePattern.

     new Cleave('.my-input', {
            date: true,
            datePattern: ['D', 'M', 'Y', '.'],
            delimiter: '.'
        });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search