aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.datepicker.js
diff options
context:
space:
mode:
authorKeith Wood <kbwood.au@gmail.com>2009-04-01 10:11:35 +0000
committerKeith Wood <kbwood.au@gmail.com>2009-04-01 10:11:35 +0000
commit4d5f8d4ae07826aa6e118e2c6b2ef81ae00d57ff (patch)
tree58008f64a515c5ce8ef20ffdaaaecb8bcf099430 /ui/ui.datepicker.js
parent73abb29d2c8d546657a14729692a4d43731d2dda (diff)
downloadjquery-ui-4d5f8d4ae07826aa6e118e2c6b2ef81ae00d57ff.tar.gz
jquery-ui-4d5f8d4ae07826aa6e118e2c6b2ef81ae00d57ff.zip
Datepicker: fixed #4301 - option dateFormat getter does not return same value as setter
Diffstat (limited to 'ui/ui.datepicker.js')
-rw-r--r--ui/ui.datepicker.js29
1 files changed, 17 insertions, 12 deletions
diff --git a/ui/ui.datepicker.js b/ui/ui.datepicker.js
index 947efc869..18b1aabf5 100644
--- a/ui/ui.datepicker.js
+++ b/ui/ui.datepicker.js
@@ -364,31 +364,33 @@ $.extend(Datepicker.prototype, {
}
},
- /* Update the settings for a date picker attached to an input field or division.
+ /* Update or retrieve the settings for a date picker attached to an input field or division.
@param target element - the target input field or division or span
@param name object - the new settings to update or
- string - the name of the setting to change or
- @param value any - the new value for the setting (omit if above is an object) */
+ string - the name of the setting to change or retrieve,
+ when retrieving also 'all' for all instance settings or
+ 'defaults' for all global defaults
+ @param value any - the new value for the setting
+ (omit if above is an object or to retrieve a value) */
_optionDatepicker: function(target, name, value) {
+ var inst = this._getInst(target);
+ if (arguments.length == 2 && typeof name == 'string') {
+ return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
+ (inst ? (name == 'all' ? $.extend({}, inst.settings) :
+ this._get(inst, name)) : null));
+ }
var settings = name || {};
if (typeof name == 'string') {
settings = {};
settings[name] = value;
}
- var inst = this._getInst(target);
if (inst) {
if (this._curInst == inst) {
this._hideDatepicker(null);
}
+ var date = this._getDateDatepicker(target);
extendRemove(inst.settings, settings);
- var date = new Date();
- extendRemove(inst, {rangeStart: null, // start of range
- endDay: null, endMonth: null, endYear: null, // end of range
- selectedDay: date.getDate(), selectedMonth: date.getMonth(),
- selectedYear: date.getFullYear(), // starting point
- currentDay: date.getDate(), currentMonth: date.getMonth(),
- currentYear: date.getFullYear(), // current selection
- drawMonth: date.getMonth(), drawYear: date.getFullYear()}); // month being drawn
+ this._setDateDatepicker(target, date);
this._updateDatepicker(inst);
}
},
@@ -1611,6 +1613,9 @@ $.fn.datepicker = function(options){
if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate'))
return $.datepicker['_' + options + 'Datepicker'].
apply($.datepicker, [this[0]].concat(otherArgs));
+ if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
+ return $.datepicker['_' + options + 'Datepicker'].
+ apply($.datepicker, [this[0]].concat(otherArgs));
return this.each(function() {
typeof options == 'string' ?
$.datepicker['_' + options + 'Datepicker'].