Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't simply format part of a date #687

Open
vgjenks opened this issue Mar 14, 2022 · 1 comment
Open

Can't simply format part of a date #687

vgjenks opened this issue Mar 14, 2022 · 1 comment

Comments

@vgjenks
Copy link

vgjenks commented Mar 14, 2022

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".

@ghost
Copy link

ghost commented Mar 18, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant