onActiveStartDateChange not fired when navigating to the first period in a view #970
Open
2 tasks done
Labels
bug
Something isn't working
Before you start - checklist
Description
The
onActiveStartDateChange
is not fired when drilling down to the first period from any view. For instanceSteps to reproduce
Add an
onActiveStartDateChange
handler which logs the args.Expected behavior
onActiveStartDateChange
is fired when drilling down from and to any level, regardless of which month is selected.Actual behavior
onActiveStartDateChange
is not fired when drilling down to the first period. See:Additional information
Note: This is related to #458, but that issue only refers to navigating to January from the year view.
Looking at the code I think the main issues is the check here for
areDatesEqual
because if I understand it navigating to the year view sets the active date to January 1st.Maybe I'm missing the complexity here, but could this not be resolved by changing the line from
to something naive like:
I think this would only capture the instances where it doesn't currently fire, but I'm not familiar enough with the code base to be sure. Are there circumstances where it wouldn't be appropriate to fire the event when drilling down to January?
Actually on reflection you may also need to check for
drillUp
when January is selected and you drill up the event won't currently fire, but it will if you're in February for the firstdrillUp
but not subsequent ones.Environment
"react-calendar": "^5.1.0"
"react": "^18"
The text was updated successfully, but these errors were encountered: