Side navigation
#1858 closed bug (wontfix)
Opened October 30, 2007 03:07AM UTC
Closed January 07, 2008 04:36AM UTC
$(".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: | |
Blocked by: | Blocking: |
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),
parseInt(fields[1], 10) - 1,
parseInt(fields[0], 10)));
};
});
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.