Ticket #1858 (closed bug: wontfix)
$(".calendarRange").calendar({ dateFormat: 'YMD-' });
| Reported by: | zcm8181 | Owned by: | iMarc |
|---|---|---|---|
| Priority: | major | Milestone: | 1.2.1 |
| Component: | ui | Version: | 1.2.1 |
| Keywords: | calendar | Cc: | |
| Blocking: | Blocked by: |
Description
The code is like next, if there are to date blank(state date and end date),if we set this attribute [dateFormat: 'YMD-'], then the date limit of calendar was invalidate.
For example, if the start date is 2007-10-10,then if we focus end date, the day before 2007-10-10 should invalidate, but it is validate now. I think the function of getDate should be improved!
======================
$(document).ready(function(){
$(".calendarRange").calendar({ dateFormat: 'YMD-' });
$(".calendarRange").calendar({ fieldSettings : customRange});
function customRange(input) {
return {minDate: (input.id == 'dTo' ? getDate($('#dFrom').val()) : null),
maxDate: (input.id == 'dFrom' ? getDate($('#dTo').val()) : null)};
};
function getDate(value) {
fields = value.split('/'); return (fields.length < 3
? null
: new Date(parseInt(fields[2], 10),
};
}); =====================
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

This function is not part of the main calendar code. It appears in the demonstration page to show how a calendar range might be implemented. It assumes that the date format is dd/mm/yyyy. Feel free to change it for your own purposes.