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

set time and date deltas on init when inputs have values #14

Closed rhec closed 10 years ago

rhec commented 10 years ago

This fixes issues I had with Datepair.js when attaching it to form inputs which already had values. The time and date deltas were not set in that case, so when you changed the start of the pair it changed the end to the same value.

It probably could be done a little more nicely so the code to set deltas is shared between the Datepair constructor and the _dateChanged and _timeChanged functions. I'll leave it up to you to make that call as I haven't really spent a ton of time looking at how it's organized.

jonthornton commented 10 years ago

This looks as clean as it will get. Thanks for coding up a fix!