From: Anthony Talarico Date: Tue, 3 Nov 2015 15:23:42 +0000 (-0500) Subject: Date restrictions added for arrival and departure date. X-Git-Tag: v1.0.0^2~31 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=59f7fc0dfeb5fc070ea55446c3a41de204b2fb10;p=WP-Themes%2Fbpla.git Date restrictions added for arrival and departure date. --- diff --git a/js/app.js b/js/app.js index 6c4b73e..e9b5bb4 100644 --- a/js/app.js +++ b/js/app.js @@ -71,7 +71,6 @@ $(document).ready(function () { // restrict arrival date ////////////////////////////////////////////// $(document).on('change', '#dateOff1', function () { currentDate = $("#dateOff1").val(); - //alert(currentDate); currentDate = new Date(currentDate); currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate()); minDays = 2; @@ -89,6 +88,19 @@ $(document).ready(function () { if (requiredDate < $('#dateOff1').attr("min")) { minDays = $('#dateOff1').attr("min"); $("#dateOff1").val(minDays); + $("#dateOff2").val($('#dateOff2').attr("min")); + } else { + 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; + $("#dateOff2").val(requiredDate); } }); // restrict departure date /////////////////////////////// @@ -108,7 +120,7 @@ $(document).ready(function () { y = currentDate.getFullYear(); requiredDate = y + '-' + m + '-' + d; if ($("#dateOff2").val() < $('#dateOff2').attr("min")) { - $("#dateOff2").val(requiredDate); + // $("#dateOff2").val(requiredDate); } }); $("#date1").datepicker({ @@ -130,12 +142,12 @@ $(document).ready(function () { //$("#date2").val(requiredDate); $("#date2").datepicker({ onSelect: function (date) { - departure = $("#date2").val(); + // departure = $("#date2").val(); } }); // off canvas menu values ///////////////////////// $('#offGuests').blur(function () { - guests = $('#offGuests').val(); + //guests = $('#offGuests').val(); }); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 47e8f45..605b260 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -62,7 +62,6 @@ $(document).ready(function () { // restrict arrival date ////////////////////////////////////////////// $(document).on('change', '#dateOff1', function () { currentDate = $("#dateOff1").val(); - //alert(currentDate); currentDate = new Date(currentDate); currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate()); minDays = 2; @@ -80,6 +79,19 @@ $(document).ready(function () { if (requiredDate < $('#dateOff1').attr("min")) { minDays = $('#dateOff1').attr("min"); $("#dateOff1").val(minDays); + $("#dateOff2").val($('#dateOff2').attr("min")); + } else { + 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; + $("#dateOff2").val(requiredDate); } }); // restrict departure date /////////////////////////////// @@ -99,7 +111,7 @@ $(document).ready(function () { y = currentDate.getFullYear(); requiredDate = y + '-' + m + '-' + d; if ($("#dateOff2").val() < $('#dateOff2').attr("min")) { - $("#dateOff2").val(requiredDate); + // $("#dateOff2").val(requiredDate); } }); $("#date1").datepicker({ @@ -121,12 +133,12 @@ $(document).ready(function () { //$("#date2").val(requiredDate); $("#date2").datepicker({ onSelect: function (date) { - departure = $("#date2").val(); + // departure = $("#date2").val(); } }); // off canvas menu values ///////////////////////// $('#offGuests').blur(function () { - guests = $('#offGuests').val(); + //guests = $('#offGuests').val(); });