From: Anthony Talarico Date: Mon, 2 Nov 2015 21:45:39 +0000 (-0500) Subject: Setting default values to off canvas datepickers X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=dc3f9f1062e20fb70ec0c6ff147a32237edfd541;p=WP-Themes%2Fglmthemes%2Fbpla-theme.git Setting default values to off canvas datepickers --- diff --git a/js/app.js b/js/app.js index 14c170a..262c3b3 100644 --- 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"); + } }); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 70b46f4..68d0dcc 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -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"); + } });