Setting default dates in reservation menu
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 30 Oct 2015 16:17:36 +0000 (12:17 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 30 Oct 2015 16:17:36 +0000 (12:17 -0400)
header.php
js/app.js
js/custom/pageSetup.js

index 56ffbbd..1e5614b 100644 (file)
                                             <input id="propsearch" type="text" placeholder="Search by property" name="s">
                                         </div>
                                         <div class="large-2 res-date columns">
-                                            <input id="date1" name="ArrivalDate" placeholder="Arrival" type="text" >
+                                            <input id="date1" name="ArrivalDate"  type="text" >
                                      <img id="cal1" src="<?php echo get_template_directory_uri(); ?>/assets/calendar-icon.jpg" title="..." alt="..." class="ui-datepicker-trigger">
                                         </div>
                                         <div class="large-2 res-date columns">
-                                            <input id="date2" name="DepartureDate"type="text" placeholder="Depart" name="datepicker2" required="required">
+                                            <input id="date2" name="DepartureDate"type="text" name="datepicker2" required="required">
                                             <img id="cal2" src="<?php echo get_template_directory_uri(); ?>/assets/calendar-icon.jpg" title="..." alt="..." class="ui-datepicker-trigger">
                                         </div>
                                         <div class="large-2 guest columns">
index 09f0dfd..2d8b28d 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -16,6 +16,12 @@ $(document).ready(function () {
         guests,
         departure,
         nights,
+        today,
+        minDays,
+        requiredDate,
+        d,
+        m,
+        y,
         page;
     $('ul.children').each(function () {
         $(this).before('<a class="toggle" href="#"></a>');
@@ -66,7 +72,14 @@ $(document).ready(function () {
     $("#offCal2").click(function () {
         $("#dateOff2").datepicker("show");
     });
-
+    today = new Date();
+    minDays = 2;
+    today.setDate(today.getDate() + minDays);
+    d = today.getDate();
+    m = today.getMonth() + 1;
+    y = today.getFullYear();
+    requiredDate = m + '/' + d + '/' + y;
+    $("#date1").val(requiredDate);
     $("#date1").datepicker({
         minDate: 2,
         onSelect: function (date) {
@@ -75,10 +88,13 @@ $(document).ready(function () {
             nights.setDate(nights.getDate() + 2);
             $("#date2").datepicker("option", {minDate: new Date(nights)});
             arrival = $("#date1").val();
-         
-
         }
     });
+    d = today.getDate() + 2;
+    m = today.getMonth() + 1;
+    y = today.getFullYear();
+    requiredDate = m + '/' + d + '/' + y;
+    $("#date2").val(requiredDate);
     $("#date2").datepicker({
         onSelect: function (date) {
             departure = $("#date2").val();
index d931987..df431e7 100644 (file)
@@ -7,6 +7,12 @@ $(document).ready(function () {
         guests,
         departure,
         nights,
+        today,
+        minDays,
+        requiredDate,
+        d,
+        m,
+        y,
         page;
     $('ul.children').each(function () {
         $(this).before('<a class="toggle" href="#"></a>');
@@ -57,7 +63,14 @@ $(document).ready(function () {
     $("#offCal2").click(function () {
         $("#dateOff2").datepicker("show");
     });
-
+    today = new Date();
+    minDays = 2;
+    today.setDate(today.getDate() + minDays);
+    d = today.getDate();
+    m = today.getMonth() + 1;
+    y = today.getFullYear();
+    requiredDate = m + '/' + d + '/' + y;
+    $("#date1").val(requiredDate);
     $("#date1").datepicker({
         minDate: 2,
         onSelect: function (date) {
@@ -66,10 +79,13 @@ $(document).ready(function () {
             nights.setDate(nights.getDate() + 2);
             $("#date2").datepicker("option", {minDate: new Date(nights)});
             arrival = $("#date1").val();
-         
-
         }
     });
+    d = today.getDate() + 2;
+    m = today.getMonth() + 1;
+    y = today.getFullYear();
+    requiredDate = m + '/' + d + '/' + y;
+    $("#date2").val(requiredDate);
     $("#date2").datepicker({
         onSelect: function (date) {
             departure = $("#date2").val();