From dc3f9f1062e20fb70ec0c6ff147a32237edfd541 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Mon, 2 Nov 2015 16:45:39 -0500 Subject: [PATCH] Setting default values to off canvas datepickers --- js/app.js | 17 +++++++++++++++-- js/custom/pageSetup.js | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) 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"); + } }); -- 2.17.1