Changed date formats to match iso specs
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 2 Nov 2015 20:58:36 +0000 (15:58 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 2 Nov 2015 20:58:36 +0000 (15:58 -0500)
js/app.js
js/custom/pageSetup.js

index 01fe368..f7e5a12 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -77,20 +77,11 @@ $(document).ready(function () {
     y = today.getFullYear();
     requiredDate = y + '-' + m + '-' + d;
     
-    $("#dateOff1").change(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;
-    });
+    currentDate = document.getElementById('dateOff1');
+
+    currentDate.addEventListener('change', function () {
+        currentDate.value = new Date(currentDate.value).toISOString().split('T')[0];
+    }, false);
     $("#date1").datepicker({
         minDate: 2,
         onSelect: function (date) {
index ae82936..4501882 100644 (file)
@@ -68,20 +68,11 @@ $(document).ready(function () {
     y = today.getFullYear();
     requiredDate = y + '-' + m + '-' + d;
     
-    $("#dateOff1").change(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;
-    });
+    currentDate = document.getElementById('dateOff1');
+
+    currentDate.addEventListener('change', function () {
+        currentDate.value = new Date(currentDate.value).toISOString().split('T')[0];
+    }, false);
     $("#date1").datepicker({
         minDate: 2,
         onSelect: function (date) {