dubrox / Multiple-Dates-Picker-for-jQuery-UI

MDP is a little plugin that enables jQuery UI calendar to manage multiple dates.
https://dubrox.github.io/Multiple-Dates-Picker-for-jQuery-UI
273 stars 157 forks source link

Define range automatically possible? #8

Open bjrnqprs opened 12 years ago

bjrnqprs commented 12 years ago

Hi,

Is there a way to define the range automatically, after picking the second day in the calendar?

Thanks in advance,

dubrox commented 12 years ago

Hi, I actually thought about it once, but than I realized it is possible to obtain a "custom range" simply by using two normal datepickers, one for the starting date and the other for the ending date.

Apart from that, if I would add this functionality to MDP I should find a way to handle a third picking: would it mean a re-definition of the start-date or of the end-date? Should the third click mean I have to clear the previous range and start a new one with beginning date at the date picked? Those are the issues why I decided not to implement that feature, but I'm open to new ideas of convenient way to do it.

bjrnqprs commented 12 years ago

Hi, ah I understand,

Well the reason I'd like to have this in a single date-picker, is that you can then style the range of selected day's. Like you do right now with a predefined range. This is much more visible and understanding for the user.

I think start and end -date could stay the same, but you'll need to calculate the days in between (on even / end-date -picks).

I think you'll want the odd-picks (1st, 3rd, 5th, etc) to define that a range is started (and a previous one is cleared completely), and the even-picks to define a range is ended. But as long as no even-pick follows, the range should only concist of the first picked date (start-date till start-date).

Would be very nice to have this feature, I don't know of any other date picker that does this. Actually one, but it is really old, and it conflicts with jQuery UI ( http://www.eyecon.ro/datepicker/ )

Thanks for any input/consideration :)

ghost commented 12 years ago

@kuipersb, I've been looking at the jQuery UI Selectable interaction (http://jqueryui.com/demos/selectable/) as a way to select a range.

So, you'd mouseDown on the StartDate, then mouseUp on the EndDate. To add to the range, you would mouseDown again on any day in the range and simply highlight additional days. However, one way to cancel the range would be to mouseDown on the EndDate and mouseUp on the StartDate (essentially, just picking the range again, but in reverse).

Do you think this solution would work for what you need?

FabrizioCo commented 8 years ago

This feature would be very useful also for me ...

ragnarkurm commented 8 years ago

+1. There could be multiple settings how this behaviour exactly works (just some ideas):