1
I’m unable to make this code work, I want some dates not selected in datepicker.
Now it is not working anymore, does not open the window to select the dates
someone can 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
});
Good morning, You didn’t help me with that code.
– Diego Marquez