-
Notifications
You must be signed in to change notification settings - Fork 1k
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
date mm parser expects zero based months #128
Comments
Although undocumented, you can already do this. It’s used internally to parse the picker = jQuery($0).data('pickadate');
picker.set('select', '2013-01-01', {format: 'yyyy-mm-dd', data: true});
picker.get(); This should parse as the expected date. I’ll leave this issue open till I update the docs. Cheers! |
I did come across that code, but it seemed like an internal detail I shouldn't rely on. I am curious though, is there something that uses zero based months in formatted strings? |
Do you mean to ask if there is any case where the zero-based months are used to generate a string value of the date? The zero-based months are mostly to keep inline with what people expect from native Date objects. It’s also much easier to deal with zero-based months when you have an array of month names that starts with 0 as the index. |
Oh and yes, it is for internal use - but I wont be changing it so I guess it's safe to use. |
Hey @amsul, new Date('2013-01-01') // Tue Jan 01 2013 00:00:00 GMT+0000 (GMT) Perhaps an alternative would be to give a format string of "iso8601" that adheres to the standard instead, like so: picker.set('select', '2013-01-01', { format: 'iso8601' }); Would you accept a pull request adding this? |
@boxofrad yup, that’s right. The native date parser does work that way. Rather than the need to pass Cheers! |
e4c91cc commit fix this. Whithout @denis-sokolov commit, default input value like 2014-03-24 show wrong month in calendar (April). |
I'm not sure if this was intended, but it would be nice if it could work with iso8601 dates.
Running this:
Yields this:
But I expected this:
Thanks!
The text was updated successfully, but these errors were encountered: