1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| $(document).ready(function()
{
var tableau= <? json_encode(!empty($tblDateEvent)? $tblDateEvent:array());?>
console.log(tableau);
$("#datepicker2").datepicker(
{
minDate: new Date($('input[name=dateMin]').val()),
maxDate: new Date($('input[name=dateMax]').val()),
beforeShowDay: function(date)
{
var m = date.getMonth();
var d = date.getDate();
var y = date.getFullYear();
if($.inArray((m +1)+'-'+d+'-'+y, tableau) !== -1)
{
return [true, 'datepickerConsoDonDay'];
}
else
{
return [true];
}
}
});
$("#datepicker1").datepicker(
{
minDate: new Date($('input[name=dateMin]').val()),
maxDate: new Date($('input[name=dateMax]').val()),
onSelect: function()
{
if ($(this).val() !== '')
{
$("#datepicker2").datepicker('option', 'minDate', $(this).val());
}
},
onClose: function ()
{
if ($(this).val() == '')
{
$("#datepicker2").datepicker('option', 'minDate', null);
}
}
});
}); |
Partager