Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prev button not working if Init with setValue for start and end dates #510

Open
voidfire opened this issue Aug 12, 2021 · 0 comments
Open

Comments

@voidfire
Copy link

voidfire commented Aug 12, 2021

If I load previously selected values from user (eg: from session or browser storage )
in dual month view prev button doesn't go back before the selected month.

Lets say we have August and I load a date range in September as I initialize the dateRangePicker
I'll be presented with September and October, Prev button won't go back to current month thus not giving the chance to user to change the selection

My current work around consists of:

showShortcuts: true,
customShortcuts: [
                {
                    name: 'Clear Selection',
                    dates: function () {
                        localStorage.removeItem("checkInDate");
                        localStorage.removeItem("checkOutDate");
                        var start = moment(new Date()).toDate();
                        var end = moment(new Date()).subtract(1, 'weeks').toDate();
                        return [start, end];
                    }
                }           
            ],

Which will return the first DatePicker to current month and clean browser storage

But I wonder if there's a better way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant