Hi,
i am trying to insert a datepicker calendar with holidays and weekends blocked, when i run my code outside of Laserfiche it works normaly, but when i try to run it in Forms with javascript code i only have the displayed calendar and holidays are not blocked. what's wrong ? i have too this error in my calendar when i choose date
Value must be between 1900-01-01 and 2200-12-31.
this is my code
$(document).ready(function () {
var holidays = [
'1.1.2021',
'2.1.2020',
'20.2.2020',
'19.1.2020',
'1.8.2020',
'15.8.2020',
'1.11.2020',
'8.12.2020',
'25.12.2020',
'26.12.2020'
];
function noSundaysOrHolidays(date) {
var day = date.getDay();
if (day != 0) {
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
for (i = 0; i < holidays.length; i++) {
if($.inArray((d) + '.' + (m+1) + '.' + y, holidays) != -1) {
return [false];
}
}
return [true];
} else {
return [day != 0, ''];
}
}
$('#Field6').datepicker({
onClose: function(dateText, inst) {
$(this).attr("disabled", false);
},
beforeShow: function(input, inst) {
$(this).attr("disabled", true);
},
beforeShowDay: noSundaysOrHolidays,
minDate: 0,
dateFormat: 'dd.mm.yy',
});
});