U4-516 - Fix DatePicker with time default value

Enables the standard jQuery date picker to parse the current value of
the field correctly, this prevents it from defaulting to Today and
overwriting the currently stored value.
This commit is contained in:
Robert Stocks
2013-08-27 12:04:20 +01:00
parent 53b6fb7b56
commit 23e4003af0

View File

@@ -62,9 +62,19 @@ $.datepicker._connectDatepicker = function(target, inst) {
*/
$.datepicker._showDatepickerOverride = $.datepicker._showDatepicker;
$.datepicker._showDatepicker = function (input) {
// keep the current value
var originalval = input.value;
// Keep the first 10 chars for now yyyy-mm-dd - this removes the time part which was breaking the standardDatePicker parsing code
input.value = originalval.length>10 ? originalval.substring(0, 10) : originalval;
// Call the original method which will show the datepicker
$.datepicker._showDatepickerOverride(input);
// Put it back
input.value = originalval;
input = input.target || input;
// find from button/image trigger