$(function() {
if(!noText('day1a')){hyouji('day1','time1');}
// if(!noText('day2a')){hyouji('day2','time2');}
// if(!noText('day3a')){hyouji('day3','time3');}
datepickerset('datepicker','day1','time1');
// datepickerset('datepicker2','day2','time2');
// datepickerset('datepicker3','day3','time3');
});
function datepickerset(num1,num2,num3){
var holidays = holidayslist();
var hide = hidelist();
$("."+num1).datepicker({
showOn: "both",
buttonImage: "./img/cal.jpg",
buttonImageOnly: true,
dateFormat: 'yy年m月d日(D)', //表示フォーマット
minDate: '+1', //当日予約不可
maxDate: '+2w', //2週間
//minDate: new Date(2023, 8, 16),
//maxDate: new Date(2023, 9, 31),
beforeShowDay: function(day) {
var result;
switch (day.getDay()) {
//case 1: // 月曜日を選択できないようにする
//result = [false,''];
//break;
//case 2: // 火曜日を選択できないようにする
//result = [false,''];
//break;
case 3: // 水曜日を選択できないようにする
result = [false,''];
break;
case 4: // 木曜日を選択できないようにする
result = [false,''];
break;
//case 5: // 金曜日を選択できないようにする
//result = [false,''];
//break;
case 0: //日曜
result = [true, 'sunday'];
break;
case 6: //土曜
result = [true, 'saturday'];
break;
default:
result = [true,'']; // それ以外は選択できる
break;
}
//20220323
//第2火曜定休
// var htime_t2 = getWeekOfDay(day.getFullYear(), day.getMonth()+1, 2, 2).replace(/-/g,'/');
// var htime2 = Date.parse(htime_t2); //非表示を 'YYYY-MM-DD' から time へ変換
// var hiday2 = new Date();
// hiday2.setTime(htime2); // 上記 time を Date へ設定
//
// // 非表示
// if (hiday2.getYear() == day.getYear() &&
// hiday2.getMonth() == day.getMonth() &&
// hiday2.getDate() == day.getDate()) {
// result = [false,''];
// }
//20220323
for (var i = 0; i < holidays.length; i++) {
var htime_t = holidays[i].replace(/-/g,'/');
var htime = Date.parse(htime_t); // 祝日を 'YYYY-MM-DD' から time へ変換
var holiday = new Date();
holiday.setTime(htime); // 上記 time を Date へ設定
// 祝日
if (holiday.getYear() == day.getYear() &&
holiday.getMonth() == day.getMonth() &&
holiday.getDate() == day.getDate()) {
result = [true, 'holiday'];
}
}
for (var i = 0; i < hide.length; i++) {
var htime_t = hide[i].replace(/-/g,'/');
var htime = Date.parse(htime_t); // 祝日を 'YYYY-MM-DD' から time へ変換
var hiday = new Date();
hiday.setTime(htime); // 上記 time を Date へ設定
// 祝日
if (hiday.getYear() == day.getYear() &&
hiday.getMonth() == day.getMonth() &&
hiday.getDate() == day.getDate()) {
result = [false,''];
}
}
//急遽仕方なく
var hogedesu = [
'2023-01-05'
];
for (var i = 0; i < hogedesu.length; i++) {
var hotime_t = hogedesu[i].replace(/-/g,'/');
var hotime = Date.parse(hotime_t); // 祝日を 'YYYY-MM-DD' から time へ変換
var hoiday = new Date();
hoiday.setTime(hotime); // 上記 time を Date へ設定
// 祝日
if (hoiday.getYear() == day.getYear() &&
hoiday.getMonth() == day.getMonth() &&
hoiday.getDate() == day.getDate()) {
result = [true,''];
}
}
//急遽仕方なく
return result;
},
onSelect: function(dataText, inst){
$("#date_val").val();
hyouji(num2,num3);
}
});
}
function hyouji(num1,num2){
var result_day = JSON.parse('["2014\u5e746\u670827\u65e5\uff08\u571f\uff09\/*\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u306a\u306e\u3067\u6d88\u3055\u306a\u3044\u3067","2023\u5e749\u670816\u65e5\uff08\u571f\uff09","2023\u5e749\u670830\u65e5\uff08\u571f\uff09","2024\u5e744\u670816\u65e5\uff08\u706b\uff09","2024\u5e744\u670819\u65e5\uff08\u91d1\uff09","2024\u5e744\u670820\u65e5\uff08\u571f\uff09","2024\u5e744\u670821\u65e5\uff08\u65e5\uff09","2024\u5e744\u670823\u65e5\uff08\u706b\uff09","2024\u5e744\u670826\u65e5\uff08\u91d1\uff09","2024\u5e744\u670827\u65e5\uff08\u571f\uff09","2024\u5e744\u670828\u65e5\uff08\u65e5\uff09","2024\u5e744\u670829\u65e5\uff08\u6708\uff09","2024\u5e744\u670830\u65e5\uff08\u706b\uff09","2024\u5e745\u670811\u65e5\uff08\u571f\uff09","2024\u5e745\u670812\u65e5\uff08\u65e5\uff09","2024\u5e745\u670813\u65e5\uff08\u6708\uff09","2024\u5e745\u670814\u65e5\uff08\u706b\uff09","2024\u5e745\u670819\u65e5\uff08\u65e5\uff09","2024\u5e745\u67085\u65e5\uff08\u65e5\uff09","2024\u5e745\u67086\u65e5\uff08\u6708\uff09","2024\u5e745\u67087\u65e5\uff08\u706b\uff09","2024\u5e746\u670815\u65e5\uff08\u571f\uff09","2024\u5e746\u670828\u65e5\uff08\u91d1\uff09","2024\u5e746\u670829\u65e5\uff08\u571f\uff09","2024\u5e746\u670830\u65e5\uff08\u65e5\uff09","2024\u5e746\u67088\u65e5\uff08\u571f\uff09","2024\u5e746\u67089\u65e5\uff08\u65e5\uff09","2024\u5e747\u670815\u65e5\uff08\u6708\uff09","2024\u5e747\u670823\u65e5\uff08\u706b\uff09","2024\u5e747\u67082\u65e5\uff08\u706b\uff09","2024\u5e747\u67089\u65e5\uff08\u706b\uff09","2024\u5e748\u670810\u65e5\uff08\u571f\uff09","2024\u5e748\u670811\u65e5\uff08\u65e5\uff09","2024\u5e748\u670812\u65e5\uff08\u6708\uff09","2024\u5e748\u670813\u65e5\uff08\u706b\uff09","2024\u5e748\u670814\u65e5\uff08\u6c34\uff09","2024\u5e748\u670815\u65e5\uff08\u6728\uff09","2024\u5e748\u670818\u65e5\uff08\u65e5\uff09","2024\u5e748\u670825\u65e5\uff08\u65e5\uff09","2024\u5e748\u670826\u65e5\uff08\u6708\uff09","2024\u5e748\u670827\u65e5\uff08\u706b\uff09","2024\u5e748\u670831\u65e5\uff08\u571f\uff09","2024\u5e748\u67087\u65e5\uff08\u6c34\uff09","2024\u5e748\u67088\u65e5\uff08\u6728\uff09","2024\u5e748\u67089\u65e5\uff08\u91d1\uff09","2024\u5e749\u670814\u65e5\uff08\u571f\uff09","2024\u5e749\u67087\u65e5\uff08\u571f\uff09"]');
var result_time1 = JSON.parse('[0,1,3,2,2,2,1,1,1,2,2,2,2,1,2,1,0,0,2,2,2,1,2,1,2,1,1,1,1,2,0,0,0,0,0,0,0,1,0,1,2,2,0,0,0,1,0]');
var result_time2 = JSON.parse('[0,3,3,2,2,2,1,2,2,1,1,1,2,1,2,2,0,2,1,1,1,2,2,1,1,2,2,2,2,2,2,0,0,0,0,0,0,2,0,2,1,1,0,0,0,2,2]');
var result_time3 = JSON.parse('[0,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]');
var result_time4 = JSON.parse('[0,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]');
var result_time5 = JSON.parse('[0,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]');
var result_time6 = JSON.parse('[0,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]');
var result_time7 = JSON.parse('[0,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]');
var result_time8 = JSON.parse('[0,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]');
var result_time9 = JSON.parse('[0,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]');
var result_time10 = JSON.parse('[0,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]');
var holidays = holidayslist();
var shukujitsu = 0;
val = $("#"+num1+"a").val();
for (var i = 0; i < holidays.length; i++) {
var htime_t = holidays[i].replace(/-/g,'/');
var htime = Date.parse(htime_t);
var holiday = new Date(htime);
y = holiday.getFullYear();
m = holiday.getMonth()+1;
d = holiday.getDate();
var hoge = y+"年"+m+"月"+d+"日";
if(!val.indexOf(hoge)){
shukujitsu = 1;
break;
}
}
for(var i = 0;i < result_day.length;i++){
var hage = result_day[i];
hige = new RegExp(hage);
if(val.match(hige)){
if ((val.match(/(土)/)) || (val.match(/(日)/)) || (shukujitsu == 1)) {
$('#'+num2).children().remove();
$('#'+num2).append($('