Search code examples
javascriptvue.jscleave

Cleave js date output is without delimiters


I'm using cleave.js for a date input field in my Vue.js project.

The option that I passed was this:

options="{date: true, delimiter: '/', datePattern: ['m', 'd', 'Y']}"

However, the output seems to be "12121995" instead of "12/12/1995". On the text field, it shows with the delimiters, but when I take the value, it's 12121995.


Solution

  • You're getting the raw value. See here the available methods:

    https://github.com/nosir/cleave.js/blob/master/doc/public-methods.md

    I presume you're after the formatted value:

    https://github.com/nosir/cleave.js/blob/master/doc/public-methods.md#getformattedvalue