Adding date object comparison and adding '0' to applicable days and months
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 2 Nov 2015 20:30:58 +0000 (15:30 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 2 Nov 2015 20:30:58 +0000 (15:30 -0500)
js/app.js
js/custom/pageSetup.js

index 164f4b0..01fe368 100644 (file)
--- 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;
     });
index 8566494..ae82936 100644 (file)
@@ -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;
     });