开发者

jquery run time calender date picker date changes

I recently found a problem, which can add to technology of calender A user asked it and i am extending it In jquery date picker plugin a custom code blocks few date also on initializing a date 开发者_StackOverflowfrom one plugin it effects other calender plugin The problem is if date 15,16,17 are blocked if a user selects 14 as start date and 18 as end this overlaps blocked date can you see if it can be done to stop overlapping block date and show an alert here is JS Fiddle

This is really complex problem


Asi dint got any answers here is the custom function that can achieve this. Hope it helps others

            //alert(dateText);
             var theDate = new Date(Date.parse($(this).datepicker('getDate')));
             var maxdate = $.datepicker.formatDate('d-m-yy', theDate);
var theMinDate = new Date(Date.parse($("#datepicker_1").datepicker('getDate')));                 
            var mindate = $.datepicker.formatDate('d-m-yy', theMinDate);

            alert(mindate + "\n" + maxdate);
            var stamp1 = str2date(mindate).getTime(); //First date. getTime() converts it to an integer
            var stamp2 = str2date(maxdate).getTime(); //Second date
//alert(stamp1);
//alert(stamp2);
for(var i=0; i<unavailableDates.length; i++){
   var curStamp = str2date(unavailableDates[i]).getTime();
   if(curStamp >= stamp1 && curStamp <= stamp2) //Check if it falls in range
       alert(unavailableDates[i] + " falls in range");

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜