Setting default values to off canvas datepickers
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 2 Nov 2015 21:45:39 +0000 (16:45 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 2 Nov 2015 21:45:39 +0000 (16:45 -0500)
js/app.js
js/custom/pageSetup.js

index 14c170a..262c3b3 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -67,7 +67,20 @@ $(document).ready(function () {
     $("#cal2").click(function () {
         $("#date2").datepicker("show");
     });
-  
+    today = new Date();
+    minDays = 2;
+    today.setDate(today.getDate() + minDays);
+    d = today.getDate();
+    if (d <= 9) {
+        d = '0' + d;
+    }
+    m = today.getMonth() + 1;
+    if (m <= 9) {
+        m = '0' + m;
+    }
+    y = today.getFullYear();
+    requiredDate = y + '-' + m + '-' + d;
+    $("#dateOff1").val(requiredDate);
     // restrict datepicker for days after current date and 2 days after that date [min]
     $("#dateOff1").change(function () {
         currentDate = $("#dateOff1").val();
@@ -85,7 +98,7 @@ $(document).ready(function () {
         y = today.getFullYear();
         requiredDate = y + '-' + m + '-' + d;
         if (currentDate !== requiredDate) {
-            alert("bo");
+         
         }
     
     });
index 70b46f4..68d0dcc 100644 (file)
@@ -58,7 +58,20 @@ $(document).ready(function () {
     $("#cal2").click(function () {
         $("#date2").datepicker("show");
     });
-  
+    today = new Date();
+    minDays = 2;
+    today.setDate(today.getDate() + minDays);
+    d = today.getDate();
+    if (d <= 9) {
+        d = '0' + d;
+    }
+    m = today.getMonth() + 1;
+    if (m <= 9) {
+        m = '0' + m;
+    }
+    y = today.getFullYear();
+    requiredDate = y + '-' + m + '-' + d;
+    $("#dateOff1").val(requiredDate);
     // restrict datepicker for days after current date and 2 days after that date [min]
     $("#dateOff1").change(function () {
         currentDate = $("#dateOff1").val();
@@ -76,7 +89,7 @@ $(document).ready(function () {
         y = today.getFullYear();
         requiredDate = y + '-' + m + '-' + d;
         if (currentDate !== requiredDate) {
-            alert("bo");
+         
         }
     
     });