Skip to content

Commit

Permalink
Fixes trentrichardson#750 - datetimeRange clears the time portion whe…
Browse files Browse the repository at this point in the history
…n prepopulated
  • Loading branch information
trentrichardson committed Aug 21, 2014
1 parent 80f5050 commit 915d275
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
17 changes: 15 additions & 2 deletions dist/jquery-ui-timepicker-addon.js
Original file line number Diff line number Diff line change
Expand Up @@ -1761,7 +1761,10 @@
onselect = null,
overrides = tp_inst._defaults.evnts,
fns = {},
prop;
prop,
ret,
oldVal,
$target;
if (typeof name === 'string') { // if min/max was set with the string
if (name === 'minDate' || name === 'minDateTime') {
min = value;
Expand Down Expand Up @@ -1819,11 +1822,21 @@
} else if (onselect) {
tp_inst._defaults.onSelect = onselect;
}

// Datepicker will override our date when we call _base_optionDatepicker when
// calling minDate/maxDate, so we will first grab the value, call
// _base_optionDatepicker, then set our value back.
if(min || max){
$target = $(target);
oldVal = $target.datetimepicker('getDate');
ret = this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
$target.datetimepicker('setDate', oldVal);
return ret;
}
}
if (value === undefined) {
return this._base_optionDatepicker.call($.datepicker, target, name);
}

return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
};

Expand Down
Loading

0 comments on commit 915d275

Please sign in to comment.