jonthornton / Datepair.js

A javascript plugin for intelligently selecting date and time ranges, inspired by Google Calendar.
https://www.jonthornton.com/Datepair.js
359 stars 85 forks source link

Time-only causes exception #13

Closed michael-wirth closed 10 years ago

michael-wirth commented 10 years ago

The Time-only example causes an exeception the 2nd time the the starttime is changeing.

The problem is that the script will check for the value of the endDateInput which is null, as I only have start- and endtime.

I guess as a workaround I can use a hidden field to simulate the date-start and -end, but it would nice if it would work without.

datepari.js, line:214


            if (this.endDateInput.value && this.dateDelta + this.timeDelta < _ONE_DAY && (endTime.getTime() - startTime.getTime()) * this.timeDelta < 0) {
                var offset = (endTime < startTime) ? _ONE_DAY : -1 * _ONE_DAY;
                var endDate = this.settings.parseDate(this.endDateInput);
                this.settings.updateDate(this.endDateInput, new Date(endDate.getTime() + offset));
jonthornton commented 10 years ago

Thanks for reporting the glitch!