jonthornton / Datepair.js

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

Update Datepair.js #46

Closed marcinjackowiak closed 9 years ago

marcinjackowiak commented 9 years ago

The code was throwing an error whenever bad data was entered into the time field:

Datepair.js:254 Uncaught TypeError: Cannot read property 'getTime' of null

This would then result in the bad characters not being removed and sometimes complete loss of functionality. Added else branch to prevent further processing when bad data was encountered.

jonthornton commented 9 years ago

The fix was actually pretty simple - there was a misplaced return statement. Thanks for pointing out the error!

hkgwahlberg commented 6 years ago

This fix making these bugs appear again:

https://github.com/jonthornton/Datepair.js/commit/e91dcb8b87d048c3b215d7e220f2e59bd8e99cd6 https://github.com/jonthornton/Datepair.js/commit/693587afa56caf43c8d8cf3c74bcfd213acd3df8

Solutions?

jonthornton commented 6 years ago

Thanks! I fixed #23 again. I couldn't reproduce #26- could explain that one a bit more?

KrunchMuffin commented 6 years ago

26 is happening to me again as well. 'defaultTimeDelta': null still changes the end time.

KrunchMuffin commented 6 years ago

looks like the return is missing, or moved outside. Not sure if that is the issue.

https://github.com/jonthornton/Datepair.js/blob/e91dcb8b87d048c3b215d7e220f2e59bd8e99cd6/dist/datepair.js#L257

https://github.com/jonthornton/Datepair.js/blob/d54ca5c1e9e5fce523b2976e0454d3cd556560ff/dist/datepair.js#L260