jonthornton / Datepair.js

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

Time only pair throwing TypeError when end time before start time #31

Closed jameopotato closed 9 years ago

jameopotato commented 9 years ago

"TypeError: endDate.getTime is not a function (Datepair.js:273)" is thrown on the first selection of an end time that is before the start time for a datepair that is only times.

http://jsfiddle.net/Jameopotato/61bhaum4/4/

Reproduce the error by running the fiddle and selecting an endtime of 8am. Since the default duration is 9hrs the start time will default to 11pm. This should throw the error described.

jonthornton commented 9 years ago

Thanks for taking the time to report this!

acoard commented 8 years ago

This bug seems to have come back in v0.4.7.

While Googling this problem I found this thread. When I overwrite my datepair.js with the dist/datepair.js file referenced in the above commit the problem was fixed.

Source code that works

Thanks for the lib!

jonthornton commented 8 years ago

I don't see it in the latest version, 0.4.13. If you're still seeing the error, could you post instructions to reproduce?

acoard commented 8 years ago

I hadn't tested on 0.4.13, only on 0.4.7. Didn't realize I was on such an out of date version, I only started the project recently.

I'll tested on 0.4.13 tonight and make sure it still works.

Thanks!