I'm trying to disable few date range arrays using BeforeShowDay fucntion in Bootstrap-Datepicker.
I have such code:
var dateArray2 = getDates(new Date("2016-12-20 14:57:28"), (new Date("2016-12-22 14:57:28")).addDays(0)); var dateArray3 = getDates(new Date("2016-12-22 14:57:28"), (new Date("2016-12-25 14:57:28")).addDays(0)); var dateArr = new Array(); dateArr.push(dateArray2); dateArr.push(dateArray3); //Datepicker init $('.date').datepicker({ format: 'dd-mm-yyyy', startDate: date, autoclose: true, beforeShowDay: function (date) { var string = jQuery.datepicker.formatDate('yy-mm-dd', date); $.each(dateArr,function (key, value) { return value.indexOf(string) == -1; }); } }); But looping the array with dates not working and I have no dates disabled.
How can I disable 2,3 or more arrays with dates?
Thanks.