From: Anthony Talarico Date: Tue, 17 Nov 2015 17:30:49 +0000 (-0500) Subject: Added restrictions to departure date X-Git-Tag: v1.0.0^2~3 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=bccb36ef6466b5e4fd2ef513023663f1b0abc624;p=WP-Themes%2Fbpla.git Added restrictions to departure date --- diff --git a/js/app.js b/js/app.js index 1ab6119..6ec4c6c 100644 --- a/js/app.js +++ b/js/app.js @@ -16,10 +16,11 @@ $(document).ready(function () { guests, departure, nights, - today, + departMin, minDays, requiredDate, d, + dd, m, y, currentDate, @@ -88,8 +89,14 @@ $(document).ready(function () { if (m <= 9) { m = '0' + m; } + dd = currentDate.getDate() + 2; + if (d <= 9) { + d = '0' + d; + } y = currentDate.getFullYear(); - requiredDate = y + '-' + m + '-' + d; + requiredDate = y + '-' + m + '-' + d; // selected arrival date + departMin = y + '-' + m + '-' + dd; // date + 2 days + $('#dateOff2').attr("min", departMin); if (requiredDate < $('#dateOff1').attr("min")) { minDays = $('#dateOff1').attr("min"); $("#dateOff1").val(minDays); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 50ac07a..ab4fbe7 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -7,10 +7,11 @@ $(document).ready(function () { guests, departure, nights, - today, + departMin, minDays, requiredDate, d, + dd, m, y, currentDate, @@ -79,8 +80,14 @@ $(document).ready(function () { if (m <= 9) { m = '0' + m; } + dd = currentDate.getDate() + 2; + if (d <= 9) { + d = '0' + d; + } y = currentDate.getFullYear(); - requiredDate = y + '-' + m + '-' + d; + requiredDate = y + '-' + m + '-' + d; // selected arrival date + departMin = y + '-' + m + '-' + dd; // date + 2 days + $('#dateOff2').attr("min", departMin); if (requiredDate < $('#dateOff1').attr("min")) { minDays = $('#dateOff1').attr("min"); $("#dateOff1").val(minDays);