From 88c7fd97dade4a238b3c463fa174c0785498c52c Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Tue, 10 Nov 2015 10:45:01 -0500 Subject: [PATCH] Fixing bugs in the date picker min ranges --- js/app.js | 14 +++++++------- js/custom/pageSetup.js | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/js/app.js b/js/app.js index c22ceb9..468dbc6 100644 --- a/js/app.js +++ b/js/app.js @@ -53,6 +53,10 @@ $(document).ready(function () { } y = currentDate.getFullYear(); requiredDate = y + '-' + m + '-' + d; + arrival = d + '-' + m + '-' + y; + arrival.toString(); + arrival = arrival.replace(/\//g, ""); + arrival = parseInt(arrival, 10); minDays = y + '-' + m + '-' + dd; $("#departOff").attr("min", minDays); start = "arrival_date=" + y + '-' + m + '-' + d + '&'; @@ -71,11 +75,6 @@ $(document).ready(function () { } y = currentDate.getFullYear(); requiredDate = y + '-' + m + '-' + d; - - arrival = d + '-' + m + '-' + y; - arrival.toString(); - arrival = arrival.replace(/\//g, ""); - arrival = parseInt(arrival, 10); //$("#departOff").val(requiredDate); } @@ -87,8 +86,8 @@ $(document).ready(function () { currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate()); currentDate.setDate(currentDate.getDate()); dd = currentDate.getDate() + 1; - if (d <= 9) { - d = '0' + d; + if (dd <= 9) { + dd = '0' + dd; } d = currentDate.getDate(); if (d <= 9) { @@ -101,6 +100,7 @@ $(document).ready(function () { y = currentDate.getFullYear(); requiredDate = y + '-' + m + '-' + d; departure = d + '-' + m + '-' + y; + alert(departure); departure.toString(); departure = departure.replace(/\//g, ""); departure = parseInt(departure, 10); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 8a5c35d..959b521 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -44,6 +44,10 @@ $(document).ready(function () { } y = currentDate.getFullYear(); requiredDate = y + '-' + m + '-' + d; + arrival = d + '-' + m + '-' + y; + arrival.toString(); + arrival = arrival.replace(/\//g, ""); + arrival = parseInt(arrival, 10); minDays = y + '-' + m + '-' + dd; $("#departOff").attr("min", minDays); start = "arrival_date=" + y + '-' + m + '-' + d + '&'; @@ -62,11 +66,6 @@ $(document).ready(function () { } y = currentDate.getFullYear(); requiredDate = y + '-' + m + '-' + d; - - arrival = d + '-' + m + '-' + y; - arrival.toString(); - arrival = arrival.replace(/\//g, ""); - arrival = parseInt(arrival, 10); //$("#departOff").val(requiredDate); } @@ -78,8 +77,8 @@ $(document).ready(function () { currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate()); currentDate.setDate(currentDate.getDate()); dd = currentDate.getDate() + 1; - if (d <= 9) { - d = '0' + d; + if (dd <= 9) { + dd = '0' + dd; } d = currentDate.getDate(); if (d <= 9) { @@ -92,6 +91,7 @@ $(document).ready(function () { y = currentDate.getFullYear(); requiredDate = y + '-' + m + '-' + d; departure = d + '-' + m + '-' + y; + alert(departure); departure.toString(); departure = departure.replace(/\//g, ""); departure = parseInt(departure, 10); -- 2.17.1