longbill/jquery-date-range-picker

change only second date

peterbardawil opened this issue · 3 comments

I tried a lot of methods but didn't work is there anyway we can only set the second date if it's greater than the first date.

Hi, @peterbardawil. If I understand your issue correctly, you want your users to be able to only select dates forward? Please see example 38 which uses the selectForward option and let me know if it fixes your issue.

Hi,

at first, happy new year to everyone :)

I think the question is not answered yet.
I am also looking for a solution, as I understand the opener.

Example:
We have already selected a date range, for example 2019/01/01 to 2019/02/02.
Now we open the picker again and select the 2019/03/03.

The desired result would be a changed of the second(to) date to 2019/03/03.

Best,
Christoph

This seems a bit like weird UX in my opinion, but you can definitely use the datepicker-first-date-selected event to detect when the first date is changed, keep a copy of the previous selection somewhere and compare that to the current first date selected and set the second one if necessary.

I am closing this issue as answered, feel free to continue this thread if things are still not clear.