diff --git a/js/osticket.js b/js/osticket.js index f5fa852e84f5a3fc7ca372c0c37b1be9e0c99691..7cd637fae03b0d92fc1f925b664e36a636f58818 100644 --- a/js/osticket.js +++ b/js/osticket.js @@ -214,3 +214,16 @@ showImagesInline = function(urls, thread_id) { } }); } + +$(document).on('submit', 'form', function() { + // Reformat dates + $('.dp', $(this)).each(function(i, e) { + var $e = $(e), + d = $e.datepicker('getDate'); + if (!d) return; + var day = ('0'+d.getDate()).substr(-2), + month = ('0'+(d.getMonth()+1)).substr(-2), + year = d.getFullYear(); + $e.val(year+'-'+month+'-'+day); + }); +});