From: Anthony Talarico Date: Mon, 2 Nov 2015 20:58:36 +0000 (-0500) Subject: Changed date formats to match iso specs X-Git-Tag: v1.0.0^2~37 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=0e389abd11d89508db911deb7b669bbc2cabd370;p=WP-Themes%2Fbpla.git Changed date formats to match iso specs --- 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) {