Feature #2717: dcc.DateRangeSlider and dcc.DateSlider#3802
Conversation
existing sliders to make them date-compatible) Components wrap existing sliders to make them date-compatible, converting date strings to timestamps. Features include date-based stepping (years/months/days), indicators/snapping for disabled dates, and optional DatePickerSingle inputs. This prevents users from having to use complex work arounds just to include dates in sliders, like in the mentioned issue. Closes plotly#2717 Co-authored-by: Francisco Cruz <francisco.oliveira.cruz@tecnico.ulisboa.pt>
|
|
Hi @ines-om Nice work on this PR. Date-based controls are tricky to implement, and date sliders would be a nice addition to Dash. I spent some time testing it and wanted to share some initial feedback. I'll add more comments as I continue trying different features.
That's all I've found so far. Overall, this is a solid start! |






This PR fixes #2717.
We implement a
dcc.DateRangeSliderand adcc.DateSliderthat wraps the existing sliders, making them date compatible.The features developed include:
disable_flagsanddisabled_datesprops;disabled_dates_indicatorprop;no_disabled_in_betweenprop, which wasn't in the original plan but made sense to include.We initially proposed the ability to disable holidays, but decided against it because it would have meant maintaining holiday data for different countries, which felt like too much added complexity for limited benefit (users can just pass in the dates they want to disable).
These components make use of the previous sliders’ props, like steps (now year, month and day based), marks, min, max, vertical, etc.
Contributor Checklist
fragments/DateRangeSlider.tsxwrapping `dcc.RangeSlider'components/DateRangeSlider.tsxDateSlider.tsxwrappingdcc.DateRangeSlidersliders.cssto contain date slider logic and addition of disabled dates indicatortypes.tsto include date sliders' propshelpers.tsfunctions for logic of disabling dates, stepping dates, dealing with disabled date ranges, enforcing the optional no disabled dates in between rule, etc.utils/computeDateSliderMarkers.tshelpers.test.tsandcomputeDateSliderMarkers.test.tsoptionals
CHANGELOG.md