fixed off canvas res form logic
authorAnthony Talarico <talarico@gaslightmedia.com>
Wed, 2 Dec 2015 21:38:41 +0000 (16:38 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Wed, 2 Dec 2015 21:38:41 +0000 (16:38 -0500)
js/app.js
js/custom/pageSetup.js

index 783dcf9..2ffa2bc 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -50,7 +50,6 @@ $(document).ready(function () {
         currentDate = new Date(currentDate);
         currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate());
         currentDate.setDate(currentDate.getDate());
-        
         d = currentDate.getDate();
         if (d <= 9) {
             d = '0' + d;
@@ -61,7 +60,13 @@ $(document).ready(function () {
         }
         y = currentDate.getFullYear();
         start = "arrival_date=" + y + '-' + m + '-' + d + '&';
-        console.log(currentDate);
+        $("#nightsOff").val(Math.ceil(currentDate2 - currentDate) / (1000 * 60 * 60 * 24));
+        if ($("#nightsOff").val() <= 0) {
+            $("#departOff").val("Minimum 1 Night");
+            $("#nightsOff").val("");
+        }
+        stay 
+      
     });
     // restrict departure date ///////////////////////////////
     $(document).on('change', '#departOff', function () {
@@ -69,37 +74,15 @@ $(document).ready(function () {
         currentDate2 = new Date(currentDate2);
         currentDate2 = new Date(currentDate2.getUTCFullYear(), currentDate2.getUTCMonth(), currentDate2.getUTCDate());
         currentDate2.setDate(currentDate2.getDate());
-        console.log(currentDate2);
         $("#nightsOff").val(Math.ceil(currentDate2 - currentDate) / (1000 * 60 * 60 * 24));
         if ($("#nightsOff").val() <= 0) {
             $("#departOff").val("Minimum 1 Night");
             $("#nightsOff").val("");
         }
         stay = 'stay_nights=' + $('#nightsOff').val() + '&';
-        console.log(stay);
+   
     });
     ///// end of canvas datepicker logic ^ //////////////////////////////////////////////
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
     /// top bar reservation form dropdown logic ////////////////////////////
     $("#arrive").datepicker({
         minDate: 0,
index d6578ed..0b399ec 100644 (file)
@@ -41,7 +41,6 @@ $(document).ready(function () {
         currentDate = new Date(currentDate);
         currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate());
         currentDate.setDate(currentDate.getDate());
-        
         d = currentDate.getDate();
         if (d <= 9) {
             d = '0' + d;
@@ -52,7 +51,13 @@ $(document).ready(function () {
         }
         y = currentDate.getFullYear();
         start = "arrival_date=" + y + '-' + m + '-' + d + '&';
-        console.log(currentDate);
+        $("#nightsOff").val(Math.ceil(currentDate2 - currentDate) / (1000 * 60 * 60 * 24));
+        if ($("#nightsOff").val() <= 0) {
+            $("#departOff").val("Minimum 1 Night");
+            $("#nightsOff").val("");
+        }
+        stay 
+      
     });
     // restrict departure date ///////////////////////////////
     $(document).on('change', '#departOff', function () {
@@ -60,37 +65,15 @@ $(document).ready(function () {
         currentDate2 = new Date(currentDate2);
         currentDate2 = new Date(currentDate2.getUTCFullYear(), currentDate2.getUTCMonth(), currentDate2.getUTCDate());
         currentDate2.setDate(currentDate2.getDate());
-        console.log(currentDate2);
         $("#nightsOff").val(Math.ceil(currentDate2 - currentDate) / (1000 * 60 * 60 * 24));
         if ($("#nightsOff").val() <= 0) {
             $("#departOff").val("Minimum 1 Night");
             $("#nightsOff").val("");
         }
         stay = 'stay_nights=' + $('#nightsOff').val() + '&';
-        console.log(stay);
+   
     });
     ///// end of canvas datepicker logic ^ //////////////////////////////////////////////
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
     /// top bar reservation form dropdown logic ////////////////////////////
     $("#arrive").datepicker({
         minDate: 0,