From bccb36ef6466b5e4fd2ef513023663f1b0abc624 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Tue, 17 Nov 2015 12:30:49 -0500 Subject: [PATCH] Added restrictions to departure date --- js/app.js | 11 +++++++++-- js/custom/pageSetup.js | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) 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); -- 2.17.1