dash-core-components icon indicating copy to clipboard operation
dash-core-components copied to clipboard

Off-by-one error max_date_allowed in dcc.DatePickerRange

Open MattiasOlla opened this issue 5 years ago • 2 comments

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.

MattiasOlla avatar Sep 21 '20 16:09 MattiasOlla

Same here. Please fix.

redm123 avatar Oct 12 '20 18:10 redm123

Yes, same issure

CambridgeLv avatar Nov 11 '20 08:11 CambridgeLv