react-date-range
react-date-range copied to clipboard
staticRange with only one startDate or endDate not triggering isSelected handler
Subject of the issue
I'm trying to create a staticRange of "More than 2 years ago". Setting startDate to null and endDate to the correct date object for the staticRange entry. The isSelected
handler is not triggering when clicked.
[BUG] Bug Reproduce Steps
- Setup a DateRange component with this staticRange (uses date-fns
set()
):
[{
label: 'More than 2 years ago',
range: () => ({
startDate: null,
endDate: set(new Date(), { year: new Date().getFullYear() - 2 })
}),
isSelected(range) {
debugger;
}
}]
- Select this staticRange on the front-end
- Debugger is not triggered
[BUG] Expected behaviour
I am expecting the isSelected
method to run
Environment
Package Version: 1.4.0 React version: 16.14 Node version: 8.6 Browser: Chrome
I faced with same issue, but with both startDate & endDate as null (case "All time" not highlighted)