longbill / jquery-date-range-picker

A jQuery plugin that allows user to select a date range
MIT License
1.12k stars 579 forks source link

Shortcuts do weird things if they are out of startDate and endDate #339

Open Nakilon opened 7 years ago

Nakilon commented 7 years ago

The available period I've specified in constructor is since previous year until a nearly month ago.

                shortcuts: {
                  "prev-days": [1],
                  "prev": ["week", "month", "year"],
                  "next-days": null,
                  "next": null,
                },

Now when I choose "Week" it selects all the available period and does not fire a change event. If I don't pass the startDate and endDate to constructor it choses correctly and fires an event.

holtkamp commented 7 years ago

Please provide a "runnable" example, for example on https://jsfiddle.net, so it is reproducable.

Most contributors do not have the time to take your example and try to reproduce it. So to increase the chance somebody will help you, make it as easy as possible to do so 😄

Nakilon commented 7 years ago

It calls setDateRange() with correct parameters, and in if (!valid) condition branch showGap() forces the whole allowed range to be selected.

Nakilon commented 7 years ago

@holtkamp here is jsfiddle: https://jsfiddle.net/08zo987r/