[BUG] DatePickerSingle is extremely slow when using large number of disabled_days #1962
Closed
Description
Describe your context
Please provide us your environment, so we can easily reproduce the issue.
dash 2.0.0
dash-core-components 2.0.0
dash-extensions 0.0.67
dash-html-components 2.0.0
dash-table 5.0.0
jupyter-dash 0.4.0
OS: macOS
Browser: Chrome
Version: 96
Describe the bug
DatePickerSingle
and DatePickerRange
are extremely slow when provided a long list of disabled_days
.
For example, if one wants to disabled every day between 2010 and 2022, except the first day of each month (4000+ disabled days), then the DatePickerSingle
takes about 30 seconds to open and 30 additional seconds each time we change the month. This issue had already been reported here: plotly/dash-core-components#986
Here's a minimal reproducible example:
from dash import Dash, dcc
import pandas as pd
min_date = pd.to_datetime("2010-01-01")
max_date = pd.to_datetime("2022-01-01")
disabled_days = [x for x in pd.date_range(min_date, max_date, freq="D") if x.day != 1]
app = Dash()
app.layout = dcc.DatePickerSingle(
min_date_allowed=min_date,
max_date_allowed=max_date,
disabled_days=disabled_days
)
app.run_server(port=8051)
Expected behavior
The DatePickerSingle
should appear and be interactable instantly.
Metadata
Assignees
Labels
No labels