From 7b17ff5a1131ad0e4f3912c2320fe71345b2dc0c Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Wed, 27 Jul 2016 11:00:15 -0400 Subject: [PATCH] test setting min date for arrival using javascript instead of php since it isn't registering on the iphone --- js/app.js | 19 ++++++++++++++++++- js/custom/pageSetup.js | 19 ++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/js/app.js b/js/app.js index 25da48e..652a442 100644 --- a/js/app.js +++ b/js/app.js @@ -82,8 +82,25 @@ $(document).ready(function () { }); var extraDay, end, arrival, currentDate, currentDate2, currentDatePlusOne, requiredDate, requiredDate1, minDays, departure, stay, d, dd, m,mm, y; - + $("#arriveOff").attr("min", today); $(document).on('change', '#arriveOff', function () { + + // get current date to set min for arrival date + var today = new Date(); + var day = today.getDate(); + var month = today.getMonth()+1; //January is 0! + var yyyy = today.getFullYear(); + + if(day<10) { + day='0'+day + } + + if(month<10) { + month='0'+ month + } + + today = yyyy+'-'+month+'-'+day; + currentDate = $("#arriveOff").val(); currentDate = currentDate.replace(/-/g, "/"); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index e766db5..727bf12 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -73,8 +73,25 @@ $(document).ready(function () { }); var extraDay, end, arrival, currentDate, currentDate2, currentDatePlusOne, requiredDate, requiredDate1, minDays, departure, stay, d, dd, m,mm, y; - + $("#arriveOff").attr("min", today); $(document).on('change', '#arriveOff', function () { + + // get current date to set min for arrival date + var today = new Date(); + var day = today.getDate(); + var month = today.getMonth()+1; //January is 0! + var yyyy = today.getFullYear(); + + if(day<10) { + day='0'+day + } + + if(month<10) { + month='0'+ month + } + + today = yyyy+'-'+month+'-'+day; + currentDate = $("#arriveOff").val(); currentDate = currentDate.replace(/-/g, "/"); -- 2.17.1