I am using this multidate picker. Is it possible to use date range mode where no weekends would be selected?
I have already done multidatepicker where weekends are blocked and where user can select just 5 days but this is not my goal. I would like this functionality: when user clicks on specific date, five days in range would be highlighted without weekend days...
My code bellow:
jQuery('#deliverydate').multiDatesPicker({
minDate:0,
beforeShowDay: noWeekendsOrHolidays,
mode: 'daysRangeWithoutWeekends',
autoselectRange: [0,5],
numberOfMonths: 2
});
now I am quite near of my own solution:
I count all days which have to be enabled and all new day which have to be selected if there is weekend in range of days.
I add my new method in multidatepicker.js daysRangeWithoutWeekends where I count all new and disabled days. Then I use two foreach loops where I disable and enable new dates:
$.each(all_removed_dates, function(index, value) {
methods.removeDates.call(obj, value);
});
$.each(all_new_dates, function(index, value) {
methods.addDates.call(obj,value);
});
value is Date object. First foreach loop works perfectly and remove all highlighted weekends but second loop doesn't work. It returns me error:
Empty array of dates received.
Do you know why?
For all you do not understand what my goal is:
I have to pick 5 day in range without weekends if i click on 21.6.2012 dates 21.6., 22.6, 25.6, 26.6., 27.6. have to be selected.
With upper code I manage to remove highlighted class on weekends but don't know why second loop (look my code upper) does not highlighted 26.6.2012 and 27.6.2012.