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

Support first selection of end time and then start time #5

Closed xdmx closed 10 years ago

xdmx commented 10 years ago

Currently when you select the start time, it automatically fill the end time 1 hour after and shows the duration in hours/minutes + starting the end time list from the start time. It would be great having the same, but selecting first the end time, and then the start time. Especially showing the duration and having the end time as the last value in the start time list

So if I select "end time" 3pm, it sets "start time" at 2pm, and when I select the field I see all the durations ("2pm 1 hour", "1pm 2 hours", etc)

jonthornton commented 10 years ago

That was actually a bug - thanks for posting an issue.

As for showing a duration on the start time, that wouldn't make sense. Once a start and end time are selected, changing the start time also changes the end time so that the duration stays the same. (This is how Gcal does it.) Changing the end time is the only way to adjust the duration, which is why the duration only shows on that timepicker.