Problem
In DateRangeCalendar, clicking a day while a complete range is selected never restarts the range: react-day-picker's default addToRange moves the endpoint nearest to the clicked day instead. A user's natural "click start, click end" gesture can even cancel out exactly and leave the original range untouched. react-day-picker supports resetOnSelect for exactly this, and it already reaches DayPicker through the ...props spread, but it isn't part of DateRangeCalendarProps, so typed consumers can't opt in without a cast against an undocumented pass-through.
Proposed Solution
Expose resetOnSelect as a first-class prop on the range calendar, and document that in controlled mode the first click emits a half-open range ({ from, to: undefined }) the consumer must render back for the two-click flow to work.
Tasks
Location
packages/ui/src/calendar/date-range-calendar/index.tsx
packages/ui/src/calendar/types.ts
Context: found while fixing the date range picker in Automattic/jetpack#50179, which currently implements the restart-on-click behavior consumer-side.
Problem
In
DateRangeCalendar, clicking a day while a complete range is selected never restarts the range: react-day-picker's defaultaddToRangemoves the endpoint nearest to the clicked day instead. A user's natural "click start, click end" gesture can even cancel out exactly and leave the original range untouched. react-day-picker supportsresetOnSelectfor exactly this, and it already reachesDayPickerthrough the...propsspread, but it isn't part ofDateRangeCalendarProps, so typed consumers can't opt in without a cast against an undocumented pass-through.Proposed Solution
Expose
resetOnSelectas a first-class prop on the range calendar, and document that in controlled mode the first click emits a half-open range ({ from, to: undefined }) the consumer must render back for the two-click flow to work.Tasks
resetOnSelectto the range props inpackages/ui/src/calendar/types.tsand forward it explicitly@wordpress/componentsprivateDateRangeCalendar)Location
packages/ui/src/calendar/date-range-calendar/index.tsxpackages/ui/src/calendar/types.tsContext: found while fixing the date range picker in Automattic/jetpack#50179, which currently implements the restart-on-click behavior consumer-side.