hypeserver / react-date-range

A React component for choosing dates and date ranges.
MIT License
2.59k stars 678 forks source link

Is it possible to show a more correct second month in the Calendar? #588

Open chrisheseltine opened 2 years ago

chrisheseltine commented 2 years ago

Subject of the issue

I am using the calendar to allow the user to select a date range, up to and including today, but not after. Therefore all dates after today are disabled. I use the two calendar view, as it looks nice, but the problem is it always shows the disabled month by default, which looks bad. Is there a way to force it to show the last two months which are enabled without forcing a selection that dates back that far?

image

[BUG] Bug Reproduce Steps

Implement standard DateRangePicker component, then disabled days after today.

[BUG] Expected behaviour

Be able to set the calendar to show last two months, i.e. non-disabled dates

Environment

Package Version: 1.4.0 React version: 18.2.0 Node version: 18.1.0 Browser: Chrome Version 104.0.5112.80 (Official Build) (64-bit)

umakantp commented 9 months ago

Use calendarFocus="backwards" props, should solve your problem.