Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MattiasOlla opened this issue Sep 10, 2020 · 2 comments
Open

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

MattiasOlla opened this issue Sep 10, 2020 · 2 comments

Comments

@MattiasOlla
Copy link

@MattiasOlla MattiasOlla commented Sep 10, 2020

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
@ankh6
Copy link

@ankh6 ankh6 commented Mar 30, 2021

Hey @chriddyp I'd like to make my first contribution if the issue is free
I've searched for the module but have not found it. Could you redirect me to the relevant code section as I am not familiar (yet)
Are there other requirements in the scope of this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
@chriddyp @MattiasOlla @ankh6 and others