Skip to main content

Search and Top Navigation

#5473 closed bug (fixed)

Opened April 01, 2010 07:15PM UTC

Closed October 11, 2012 06:53PM UTC

Datepicker: Date range demo bug when clearing date

Reported by: mattac Owned by:
Priority: minor Milestone: 1.9.1
Component: ui.datepicker Version: 1.8
Keywords: Cc:
Blocked by: Blocking:
Description

I'd like to suggest an improvement to the date range limiting implementation listed here:

http://jqueryui.com/demos/datepicker/#event-search

The current implementation has a bug. If a date is selected in one field and then cleared out, the date limiting will remain for the other field. Using an onClose handler rather than onSelect enables removing the min/maxDate setting on the other field.

See the following:

    onClose: function(selectedDate) {
        if (selectedDate) {
            var option = this.id == "from" ? "minDate" : "maxDate";
	    var instance = $(this).data("datepicker");
            var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
	    dates.not(this).datepicker("option", option, date);
        }
        else {
            dates.not(this).datepicker("option", option, null);
        }
    }
Attachments (0)
Change History (2)

Changed October 11, 2012 06:53PM UTC by scottgonzalez comment:1

milestone: TBD1.9.1
summary: "Event Search" documentation bug fixDatepicker: Date range demo bug when clearing date

Changed October 11, 2012 06:53PM UTC by Scott González comment:2

resolution: → fixed
status: newclosed

Datepicker demo: Fixed date range restriction when clearing dates. Fixes #5473 - Datepicker: Date range demo bug when clearing date.

Changeset: a50516f77e82206f2d1f4188c9f5a242442ace09