Skip to content

Commit 89905e2

Browse files
committed
Datepicker: Removed remnants of range select functionality
1 parent a6c7054 commit 89905e2

1 file changed

Lines changed: 12 additions & 36 deletions

File tree

ui/ui.datepicker.js

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -411,21 +411,19 @@ $.extend(Datepicker.prototype, {
411411

412412
/* Set the dates for a jQuery selection.
413413
@param target element - the target input field or division or span
414-
@param date Date - the new date
415-
@param endDate Date - the new end date for a range (optional) */
416-
_setDateDatepicker: function(target, date, endDate) {
414+
@param date Date - the new date */
415+
_setDateDatepicker: function(target, date) {
417416
var inst = this._getInst(target);
418417
if (inst) {
419-
this._setDate(inst, date, endDate);
418+
this._setDate(inst, date);
420419
this._updateDatepicker(inst);
421420
this._updateAlternate(inst);
422421
}
423422
},
424423

425424
/* Get the date(s) for the first entry in a jQuery selection.
426425
@param target element - the target input field or division or span
427-
@return Date - the current date or
428-
Date[2] - the current dates for a range */
426+
@return Date - the current date */
429427
_getDateDatepicker: function(target) {
430428
var inst = this._getInst(target);
431429
if (inst && !inst.inline)
@@ -544,7 +542,6 @@ $.extend(Datepicker.prototype, {
544542
}
545543
var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
546544
$.datepicker._pos = null;
547-
inst.rangeStart = null;
548545
// determine sizing offscreen
549546
inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
550547
$.datepicker._updateDatepicker(inst);
@@ -605,11 +602,10 @@ $.extend(Datepicker.prototype, {
605602
var numMonths = this._getNumberOfMonths(inst);
606603
var cols = numMonths[1];
607604
var width = 17;
608-
if (cols > 1) {
605+
if (cols > 1)
609606
inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
610-
} else {
607+
else
611608
inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
612-
}
613609
inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
614610
'Class']('ui-datepicker-multi');
615611
inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
@@ -654,10 +650,6 @@ $.extend(Datepicker.prototype, {
654650
var inst = this._curInst;
655651
if (!inst || (input && inst != $.data(input, PROP_NAME)))
656652
return;
657-
if (inst.stayOpen)
658-
this._selectDate('#' + inst.id, this._formatDate(inst,
659-
inst.currentDay, inst.currentMonth, inst.currentYear));
660-
inst.stayOpen = false;
661653
if (this._datepickerShowing) {
662654
duration = (duration != null ? duration : this._get(inst, 'duration'));
663655
var showAnim = this._get(inst, 'showAnim');
@@ -770,24 +762,14 @@ $.extend(Datepicker.prototype, {
770762
inst.selectedDay = inst.currentDay = $('a', td).html();
771763
inst.selectedMonth = inst.currentMonth = month;
772764
inst.selectedYear = inst.currentYear = year;
773-
if (inst.stayOpen) {
774-
inst.endDay = inst.endMonth = inst.endYear = null;
775-
}
776765
this._selectDate(id, this._formatDate(inst,
777766
inst.currentDay, inst.currentMonth, inst.currentYear));
778-
if (inst.stayOpen) {
779-
inst.rangeStart = this._daylightSavingAdjust(
780-
new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
781-
this._updateDatepicker(inst);
782-
}
783767
},
784768

785769
/* Erase the input field and hide the date picker. */
786770
_clearDate: function(id) {
787771
var target = $(id);
788772
var inst = this._getInst(target[0]);
789-
inst.stayOpen = false;
790-
inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null;
791773
this._selectDate(target, '');
792774
},
793775

@@ -806,7 +788,7 @@ $.extend(Datepicker.prototype, {
806788
inst.input.trigger('change'); // fire the change event
807789
if (inst.inline)
808790
this._updateDatepicker(inst);
809-
else if (!inst.stayOpen) {
791+
else {
810792
this._hideDatepicker(null, this._get(inst, 'duration'));
811793
this._lastInput = inst.input[0];
812794
if (typeof(inst.input[0]) != 'object')
@@ -1145,7 +1127,6 @@ $.extend(Datepicker.prototype, {
11451127
_setDateFromField: function(inst) {
11461128
var dateFormat = this._get(inst, 'dateFormat');
11471129
var dates = inst.input ? inst.input.val() : null;
1148-
inst.endDay = inst.endMonth = inst.endYear = null;
11491130
var date = defaultDate = this._getDefaultDate(inst);
11501131
var settings = this._getFormatConfig(inst);
11511132
try {
@@ -1232,7 +1213,7 @@ $.extend(Datepicker.prototype, {
12321213
},
12331214

12341215
/* Set the date(s) directly. */
1235-
_setDate: function(inst, date, endDate) {
1216+
_setDate: function(inst, date) {
12361217
var clear = !(date);
12371218
var origMonth = inst.selectedMonth;
12381219
var origYear = inst.selectedYear;
@@ -1328,8 +1309,6 @@ $.extend(Datepicker.prototype, {
13281309
var beforeShowDay = this._get(inst, 'beforeShowDay');
13291310
var showOtherMonths = this._get(inst, 'showOtherMonths');
13301311
var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
1331-
var endDate = inst.endDay ? this._daylightSavingAdjust(
1332-
new Date(inst.endYear, inst.endMonth, inst.endDay)) : currentDate;
13331312
var defaultDate = this._getDefaultDate(inst);
13341313
var html = '';
13351314
for (var row = 0; row < numMonths[0]; row++) {
@@ -1351,7 +1330,7 @@ $.extend(Datepicker.prototype, {
13511330
(/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
13521331
(/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
13531332
this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
1354-
selectedDate, row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
1333+
row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
13551334
'</div><table class="ui-datepicker-calendar"><thead>' +
13561335
'<tr>';
13571336
var thead = '';
@@ -1385,17 +1364,15 @@ $.extend(Datepicker.prototype, {
13851364
' ' + this._dayOverClass : '') + // highlight selected day
13861365
(unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
13871366
(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
1388-
(printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
1389-
' ' + this._currentClass : '') + // highlight selected day
1367+
(printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
13901368
(printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
13911369
((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
13921370
(unselectable ? '' : ' onclick="DP_jQuery.datepicker._selectDay(\'#' +
13931371
inst.id + '\',' + drawMonth + ',' + drawYear + ', this);return false;"') + '>' + // actions
13941372
(otherMonth ? (showOtherMonths ? printDate.getDate() : '&#xa0;') : // display for other months
13951373
(unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
13961374
(printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
1397-
(printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
1398-
' ui-state-active' : '') + // highlight selected day
1375+
(printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
13991376
'" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
14001377
printDate.setDate(printDate.getDate() + 1);
14011378
printDate = this._daylightSavingAdjust(printDate);
@@ -1421,8 +1398,7 @@ $.extend(Datepicker.prototype, {
14211398

14221399
/* Generate the month and year header. */
14231400
_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
1424-
selectedDate, secondary, monthNames, monthNamesShort) {
1425-
minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate);
1401+
secondary, monthNames, monthNamesShort) {
14261402
var changeMonth = this._get(inst, 'changeMonth');
14271403
var changeYear = this._get(inst, 'changeYear');
14281404
var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');

0 commit comments

Comments
 (0)