bootstrap-datepicker
bootstrap-datepicker copied to clipboard
multidate not working when using setDate
i am unable to select multiple date when using setDate along with multidate.
for example:
var dateAdded = ["2015-07-15","2015-07-17"];
var dates = [];
$.each(dateAdded, function(i, dateStr){
var d = new Date();
var dateArray = dateStr.split("-");
d.setFullYear(parseInt(dateArray[0]));
d.setMonth(parseInt(dateArray[1])-1);
d.setDate(parseInt(dateArray[2]));
dates.push(d);
});
$(element).datepicker("setDates",dates);
above code will setDates ,when trying to select other dates the above dates will get unselected and the multiselect will not work ,you can just select one date at a time.
my bad the option multidate was only sent on attrs.$observe but not when loading the angular directive,i just added the option when loading the directive.