I'm not able to make this code work, I want some dates not to be selected in datepicker.
Now it is not working anymore, it does not open the window to select the dates
Can anyone help me?
$().ready(function()
{
var ranges = [{ start: moment(new Date('05/05/2016')).format("dd/mm/yy"), end: moment(new Date('15/05/2016')).format("dd/mm/yy") },
{ start: moment(new Date('20/06/2016')).format("dd/mm/yy"), end: moment(new Date('26/06/2016')).format("dd/mm/yy") }];
var dates = $("#dataInicio, #dataFinal")
.datepicker({
dateFormat: 'dd/mm/yy',
changeMonth: false,
numberOfMonths: 2,
beforeShowDay: function(date) {
$.each(ranges, function(index) {
if (date >= ranges[index].start && date <= ranges[index].end)
{
return [true, ''];
}
})return [false, ''];
},
minDate: ranges[0].start,
maxDate: ranges[ranges.length - 1].end,
defaultDate: ranges[0].start,
onSelect: function() {
$(this).focusin();
}
});
//Date picked fim
});