Skip to content

[BUG] Dash 4.0.0 Issue DatePickerRange: unable to select same start/end date and end_date silently retained after new start_date selection (minimum_nights=0) #3645

@sindrebenjaminremman

Description

@sindrebenjaminremman

Describe your context

dash==4.0.0
dash-bootstrap-components==2.0.4
dash-iconify==0.1.2
dash-mantine-components==2.5.1
- Windows
- Edge
- Version 145.0.3800.70 (Official build) (64-bit)

Describe the bug

Dash 4.0.0 has made some changes to DateRangePicker. I assume it is a bug, but we're unable to select the same date for start and end date. Meaning it is no longer possible to select a single date as it was before, even if we keep minimum_nights=0.

At the same time, it is possible to induce a "hidden end date". If you select a range, and select a single date afterwards, the function uses the previously selected end date. In dash <4.0.0 this was visible in the UI, but in 4.0.0 this left over end date is now hidden.

You can use the following script:

from dash import Dash, dcc, html, Input, Output

app = Dash(__name__)

app.layout = html.Div([
    dcc.DatePickerRange(
        id="date-picker",
        minimum_nights=0,
    ),
    html.Div(id="output"),
])

@app.callback(
    Output("output", "children"),
    Input("date-picker", "start_date"),
    Input("date-picker", "end_date"),
)
def display_dates(start_date, end_date):
    print(f"Selected dates: {start_date} to {end_date}")
    return f"Selected: {start_date} to {end_date}"

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8080, debug=True)

Issue with being unable to select a single date

Try to select the same date twice. You won't be able to, but you could do this with dash <4.0.0.

Issue with hidden end date

Now select a range, e.g. 2026-02-02 to 2026-02-11

Image

Then select 2026-02-04

Image

You can now see that the end date is the same as before but hidden. This caused a lot of confusion among our users.

Expected behavior

  1. Single date selection: When minimum_nights=0, selecting the same date for start and end should work (start_date == end_date).
  2. No hidden end date: When a new start date is selected, the end date should be cleared/reset, not silently retained from a previous selection.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions