cleave.js
cleave.js copied to clipboard
Can't simply format part of a date
I'm having a hard time wrapping my head around how this is even formatting, without having looked at the Cleave source myself yet.
https://codepen.io/vinjenks/pen/PoEwXBd
The date I'm providing is legit: 2017-10-01. So, I'm racking my brains to get to "10/2017" but Cleave date doesn't seem to be able to handle that. The best I can seem to get it to do is backwards, e.g. "2017/10".
Why not set the value="2017-10-01" backwards to match the format?
<input class="form-control cleave-input-date" placeholder="DD-MM-YYYY" value="10-10-2010">
var cleave = new Cleave('.cleave-input-date', {
date: true,
delimter: '-',
datePattern: ['d','m','Y']
});
https://codepen.io/DanEnglishby/pen/ywXjEx Look around for the examples: the order of the format (d,m,Y) and (dd-mm-yyyy)value specified in cleave.js are the same.