//console.log('ul = ' + menuImg);
//console.log('menu-id = ' + menuNum);
});
- //// Reservation Form logic /////////////////////////////
+
+ //// Reservation Form logic //////////////////////////////////////////////////////////////////////////////////////////////////////
// get the url to determine the page location
page = $(location).attr('pathname');
$("#cal2").click(function () {
$("#date2").datepicker("show");
});
- today = new Date();
- minDays = 2;
- today.setDate(today.getDate() + minDays);
- d = today.getDate();
- if (d <= 9) {
- d = '0' + d;
- }
- m = today.getMonth() + 1;
- if (m <= 9) {
- m = '0' + m;
- }
- y = today.getFullYear();
- requiredDate = y + '-' + m + '-' + d;
- $("#dateOff1").val(requiredDate);
- // restrict datepicker for days after current date and 2 days after that date [min]
- $("#dateOff1").change(function () {
+ // restrict arrival date //////////////////////////////////////////////
+ $(document).on('change', '#dateOff1', function () {
currentDate = $("#dateOff1").val();
- today = new Date();
+ //alert(currentDate);
+ currentDate = new Date(currentDate);
+ currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate());
minDays = 2;
- today.setDate(today.getDate() + minDays);
- d = today.getDate();
+ currentDate.setDate(currentDate.getDate());
+ d = currentDate.getDate();
if (d <= 9) {
d = '0' + d;
}
- m = today.getMonth() + 1;
+ m = currentDate.getMonth() + 1;
if (m <= 9) {
m = '0' + m;
}
- y = today.getFullYear();
+ y = currentDate.getFullYear();
requiredDate = y + '-' + m + '-' + d;
- if (currentDate !== requiredDate) {
-
+ if (requiredDate < $('#dateOff1').attr("min")) {
+ minDays = $('#dateOff1').attr("min");
+ $("#dateOff1").val(minDays);
+ }
+ });
+ // restrict departure date ///////////////////////////////
+ $(document).on('change', '#dateOff2', function () {
+ currentDate = $("#dateOff1").val();
+ currentDate = new Date(currentDate);
+ currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate());
+ currentDate.setDate(currentDate.getDate());
+ d = currentDate.getDate() + 2;
+ if (d <= 9) {
+ d = '0' + d;
+ }
+ m = currentDate.getMonth() + 1;
+ if (m <= 9) {
+ m = '0' + m;
+ }
+ y = currentDate.getFullYear();
+ requiredDate = y + '-' + m + '-' + d;
+ if ($("#dateOff2").val() < $('#dateOff2').attr("min")) {
+ $("#dateOff2").val(requiredDate);
}
-
});
-
$("#date1").datepicker({
minDate: 2,
onSelect: function (date) {
//console.log('ul = ' + menuImg);
//console.log('menu-id = ' + menuNum);
});
- //// Reservation Form logic /////////////////////////////
+
+ //// Reservation Form logic //////////////////////////////////////////////////////////////////////////////////////////////////////
// get the url to determine the page location
page = $(location).attr('pathname');
$("#cal2").click(function () {
$("#date2").datepicker("show");
});
- today = new Date();
- minDays = 2;
- today.setDate(today.getDate() + minDays);
- d = today.getDate();
- if (d <= 9) {
- d = '0' + d;
- }
- m = today.getMonth() + 1;
- if (m <= 9) {
- m = '0' + m;
- }
- y = today.getFullYear();
- requiredDate = y + '-' + m + '-' + d;
- $("#dateOff1").val(requiredDate);
- // restrict datepicker for days after current date and 2 days after that date [min]
- $("#dateOff1").change(function () {
+ // restrict arrival date //////////////////////////////////////////////
+ $(document).on('change', '#dateOff1', function () {
currentDate = $("#dateOff1").val();
- today = new Date();
+ //alert(currentDate);
+ currentDate = new Date(currentDate);
+ currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate());
minDays = 2;
- today.setDate(today.getDate() + minDays);
- d = today.getDate();
+ currentDate.setDate(currentDate.getDate());
+ d = currentDate.getDate();
if (d <= 9) {
d = '0' + d;
}
- m = today.getMonth() + 1;
+ m = currentDate.getMonth() + 1;
if (m <= 9) {
m = '0' + m;
}
- y = today.getFullYear();
+ y = currentDate.getFullYear();
requiredDate = y + '-' + m + '-' + d;
- if (currentDate !== requiredDate) {
-
+ if (requiredDate < $('#dateOff1').attr("min")) {
+ minDays = $('#dateOff1').attr("min");
+ $("#dateOff1").val(minDays);
+ }
+ });
+ // restrict departure date ///////////////////////////////
+ $(document).on('change', '#dateOff2', function () {
+ currentDate = $("#dateOff1").val();
+ currentDate = new Date(currentDate);
+ currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate());
+ currentDate.setDate(currentDate.getDate());
+ d = currentDate.getDate() + 2;
+ if (d <= 9) {
+ d = '0' + d;
+ }
+ m = currentDate.getMonth() + 1;
+ if (m <= 9) {
+ m = '0' + m;
+ }
+ y = currentDate.getFullYear();
+ requiredDate = y + '-' + m + '-' + d;
+ if ($("#dateOff2").val() < $('#dateOff2').attr("min")) {
+ $("#dateOff2").val(requiredDate);
}
-
});
-
$("#date1").datepicker({
minDate: 2,
onSelect: function (date) {