Bug Tracker

Opened 12 years ago

Closed 12 years ago

#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:
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)));

};

}); =====================

Change History (3)

comment:1 Changed 12 years ago by kbwood

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.

comment:2 Changed 12 years ago by paul

Owner: set to iMarc

comment:3 Changed 12 years ago by kbwood

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.