Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Off-by-one error max_date_allowed in dcc.DatePickerRange #867

Open
@MattiasOlla

Description

In recent versions (can't say from exactly when), there seems to be an off-by-one error in dcc.DatePickerRange. I set max_date_allowed = datetime.today().date(), but in the calendar, yesterday is the maximum date allowed. I see it in my apps, and it is also present in the first example on the DatePickerRange documentation page.

Example:

html.Div(
        dcc.DatePickerRange(
            id="date_range",
            start_date_placeholder_text="Start Period",
            end_date_placeholder_text="End Period",
            max_date_allowed=datetime.today().date(),
            display_format="YYYY-MM-DD",
            first_day_of_week=1,
            clearable=True,
            minimum_nights=0,
            persistence=True,
        ),
    )

I've also tried connecting callbacks to State("date_range", "max_date_allowed"), and there the received max date is today's date, so it only appears in the frontend.

Tested with server under both Windows 10 1909 and Linux Mint 19.1, and in both Google Chrome 85.0 and Firefox 80.0. Versions:

dash==1.16.0
dash-core-components==1.12.0
dash-html-components==1.1.1
dash-renderer==1.8.0
dash-table==4.10.1

Reported this previously in the Dash repo, but realised this is where it belongs.

Metadata

Assignees

No one assigned

    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