From cd576810c3b9f8b0e80e53e370555b9ed4a81909 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Mon, 2 Nov 2015 15:20:41 -0500 Subject: [PATCH] Converting string date into date object and matching to RFC 3339 standard --- js/app.js | 6 +++++- js/custom/pageSetup.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/js/app.js b/js/app.js index 34805bf..4c64497 100644 --- a/js/app.js +++ b/js/app.js @@ -80,7 +80,11 @@ $(document).ready(function () { $("#dateOff1").change(function () { currentDate = this.value; currentDate = new Date(currentDate); - alert(currentDate); + d = currentDate.getDate(); + m = currentDate.getMonth() + 1; + y = currentDate.getFullYear(); + requiredDate = y + '-' + m + '-' + d; + alert(requiredDate); }); $("#date1").datepicker({ minDate: 2, diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 763239f..798b5ba 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -71,7 +71,11 @@ $(document).ready(function () { $("#dateOff1").change(function () { currentDate = this.value; currentDate = new Date(currentDate); - alert(currentDate); + d = currentDate.getDate(); + m = currentDate.getMonth() + 1; + y = currentDate.getFullYear(); + requiredDate = y + '-' + m + '-' + d; + alert(requiredDate); }); $("#date1").datepicker({ minDate: 2, -- 2.17.1