From 0e389abd11d89508db911deb7b669bbc2cabd370 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Mon, 2 Nov 2015 15:58:36 -0500 Subject: [PATCH] Changed date formats to match iso specs --- js/app.js | 19 +++++-------------- js/custom/pageSetup.js | 19 +++++-------------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/js/app.js b/js/app.js index 01fe368..f7e5a12 100644 --- 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) { diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index ae82936..4501882 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -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) { -- 2.17.1