From: Anthony Talarico Date: Fri, 30 Oct 2015 16:17:36 +0000 (-0400) Subject: Setting default dates in reservation menu X-Git-Tag: v1.0.0^2~73 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=c0836eae1fa61434b3fdbbe38701f74771a4f200;p=WP-Themes%2Fbpla.git Setting default dates in reservation menu --- diff --git a/header.php b/header.php index 56ffbbd..1e5614b 100644 --- a/header.php +++ b/header.php @@ -57,11 +57,11 @@
- + ...
- + ...
diff --git a/js/app.js b/js/app.js index 09f0dfd..2d8b28d 100644 --- a/js/app.js +++ b/js/app.js @@ -16,6 +16,12 @@ $(document).ready(function () { guests, departure, nights, + today, + minDays, + requiredDate, + d, + m, + y, page; $('ul.children').each(function () { $(this).before(''); @@ -66,7 +72,14 @@ $(document).ready(function () { $("#offCal2").click(function () { $("#dateOff2").datepicker("show"); }); - + today = new Date(); + minDays = 2; + today.setDate(today.getDate() + minDays); + d = today.getDate(); + m = today.getMonth() + 1; + y = today.getFullYear(); + requiredDate = m + '/' + d + '/' + y; + $("#date1").val(requiredDate); $("#date1").datepicker({ minDate: 2, onSelect: function (date) { @@ -75,10 +88,13 @@ $(document).ready(function () { nights.setDate(nights.getDate() + 2); $("#date2").datepicker("option", {minDate: new Date(nights)}); arrival = $("#date1").val(); - - } }); + d = today.getDate() + 2; + m = today.getMonth() + 1; + y = today.getFullYear(); + requiredDate = m + '/' + d + '/' + y; + $("#date2").val(requiredDate); $("#date2").datepicker({ onSelect: function (date) { departure = $("#date2").val(); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index d931987..df431e7 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -7,6 +7,12 @@ $(document).ready(function () { guests, departure, nights, + today, + minDays, + requiredDate, + d, + m, + y, page; $('ul.children').each(function () { $(this).before(''); @@ -57,7 +63,14 @@ $(document).ready(function () { $("#offCal2").click(function () { $("#dateOff2").datepicker("show"); }); - + today = new Date(); + minDays = 2; + today.setDate(today.getDate() + minDays); + d = today.getDate(); + m = today.getMonth() + 1; + y = today.getFullYear(); + requiredDate = m + '/' + d + '/' + y; + $("#date1").val(requiredDate); $("#date1").datepicker({ minDate: 2, onSelect: function (date) { @@ -66,10 +79,13 @@ $(document).ready(function () { nights.setDate(nights.getDate() + 2); $("#date2").datepicker("option", {minDate: new Date(nights)}); arrival = $("#date1").val(); - - } }); + d = today.getDate() + 2; + m = today.getMonth() + 1; + y = today.getFullYear(); + requiredDate = m + '/' + d + '/' + y; + $("#date2").val(requiredDate); $("#date2").datepicker({ onSelect: function (date) { departure = $("#date2").val();