From 6a3af13e0c34ffe8680d32818246dd891d12aac9 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Mon, 2 Nov 2015 15:30:58 -0500 Subject: [PATCH] Adding date object comparison and adding '0' to applicable days and months --- js/app.js | 6 ++++++ js/custom/pageSetup.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/js/app.js b/js/app.js index 164f4b0..01fe368 100644 --- a/js/app.js +++ b/js/app.js @@ -81,7 +81,13 @@ $(document).ready(function () { currentDate = this.value; currentDate = new Date(currentDate); d = currentDate.getDate(); + if (d <= 9) { + d = '0' + 9; + } m = currentDate.getMonth() + 1; + if (m <= 9) { + m = '0' + m; + } y = currentDate.getFullYear(); requiredDate = y + '-' + m + '-' + d; }); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 8566494..ae82936 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -72,7 +72,13 @@ $(document).ready(function () { currentDate = this.value; currentDate = new Date(currentDate); d = currentDate.getDate(); + if (d <= 9) { + d = '0' + 9; + } m = currentDate.getMonth() + 1; + if (m <= 9) { + m = '0' + m; + } y = currentDate.getFullYear(); requiredDate = y + '-' + m + '-' + d; }); -- 2.17.1