Fixed 3080 Calls _setDateFromField when inline

Fixed 3082 Arrow keys unnecissarily bound in datepicker
Corrected otherMonth class name
Corrected getDate for ranges
This commit is contained in:
Keith Wood 2008-07-18 09:00:04 +00:00
parent 0f1592128f
commit e139f6ccaa

View File

@ -373,7 +373,7 @@ $.extend(Datepicker.prototype, {
Date[2] - the current dates for a range */ Date[2] - the current dates for a range */
_getDateDatepicker: function(target) { _getDateDatepicker: function(target) {
var inst = $.data(target, PROP_NAME); var inst = $.data(target, PROP_NAME);
if (inst) if (inst && !inst.inline)
this._setDateFromField(inst); this._setDateFromField(inst);
return (inst ? this._getDate(inst) : null); return (inst ? this._getDate(inst) : null);
}, },
@ -399,16 +399,22 @@ $.extend(Datepicker.prototype, {
+$.datepicker._get(inst, 'stepMonths')), (e.ctrlKey ? 'Y' : 'M')); +$.datepicker._get(inst, 'stepMonths')), (e.ctrlKey ? 'Y' : 'M'));
break; // next month/year on page down/+ ctrl break; // next month/year on page down/+ ctrl
case 35: if (e.ctrlKey) $.datepicker._clearDate(e.target); case 35: if (e.ctrlKey) $.datepicker._clearDate(e.target);
handled = e.ctrlKey;
break; // clear on ctrl+end break; // clear on ctrl+end
case 36: if (e.ctrlKey) $.datepicker._gotoToday(e.target); case 36: if (e.ctrlKey) $.datepicker._gotoToday(e.target);
handled = e.ctrlKey;
break; // current on ctrl+home break; // current on ctrl+home
case 37: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -1, 'D'); case 37: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -1, 'D');
handled = e.ctrlKey;
break; // -1 day on ctrl+left break; // -1 day on ctrl+left
case 38: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -7, 'D'); case 38: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -7, 'D');
handled = e.ctrlKey;
break; // -1 week on ctrl+up break; // -1 week on ctrl+up
case 39: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +1, 'D'); case 39: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +1, 'D');
handled = e.ctrlKey;
break; // +1 day on ctrl+right break; // +1 day on ctrl+right
case 40: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +7, 'D'); case 40: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +7, 'D');
handled = e.ctrlKey;
break; // +1 week on ctrl+down break; // +1 week on ctrl+down
default: handled = false; default: handled = false;
} }
@ -1188,7 +1194,8 @@ $.extend(Datepicker.prototype, {
var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null : var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
new Date(inst.currentYear, inst.currentMonth, inst.currentDay)); new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
if (this._get(inst, 'rangeSelect')) { if (this._get(inst, 'rangeSelect')) {
return [inst.rangeStart || startDate, (!inst.endYear ? null : return [inst.rangeStart || startDate,
(!inst.endYear ? inst.rangeStart || startDate :
new Date(inst.endYear, inst.endMonth, inst.endDay))]; new Date(inst.endYear, inst.endMonth, inst.endDay))];
} else } else
return startDate; return startDate;
@ -1316,7 +1323,7 @@ $.extend(Datepicker.prototype, {
(minDate && printDate < minDate) || (maxDate && printDate > maxDate); (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
html += '<td class="ui-datepicker-days-cell' + html += '<td class="ui-datepicker-days-cell' +
((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end-cell' : '') + // highlight weekends ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end-cell' : '') + // highlight weekends
(otherMonth ? ' ui-datepicker-otherMonth' : '') + // highlight days from other months (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
(printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth ? (printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth ?
' ui-datepicker-days-cell-over' : '') + // highlight selected day ' ui-datepicker-days-cell-over' : '') + // highlight selected day
(unselectable ? ' ' + this._unselectableClass : '') + // highlight unselectable days (unselectable ? ' ' + this._unselectableClass : '') + // highlight unselectable days