Datepicker start, and end_date not persistent when set from callback.
I have a callback that sets the datepickers start- and end_date to today. When I refresh the site the dates change to the previous manually selected dates. I.e the dates set by the callback are not persistent.
dash 1.19.0
dash-bootstrap-components 0.11.3
dash-core-components 1.15.0
dash-extensions 0.0.46
dash-html-components 1.1.2
dash-renderer 1.9.0
dash-table 4.11.2
-
if frontend related, tell us your Browser, Version and OS
- OS: [Ubuntu 20.0]
- Browser [chrome]
- Version [22]
Describe the bug
As described above. Dates set manually by a user are persistent, but dates set by callbacks are not.
Datepicker:
datepicker = dcc.DatePickerRange(
id='datepicker',
start_date=date.today(),
end_date=date.today(),
start_date_placeholder_text='Fra',
end_date_placeholder_text='Til',
initial_visible_month=datetime.now(),
first_day_of_week=1,
minimum_nights=0,
persistence=True,
persistence_type='session',
persisted_props=['start_date', 'end_date'],
with_portal=True,
show_outside_days=True,
),
Callback:
@app.callback(
[Output('datepicker', 'start_date'),
Output('datepicker', 'end_date')],
Input('today_button', 'n_clicks'),
)
def set_datepicker_today(n):
return [date.today(), date.today()] if n else dash.no_update
Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are most important to our community. If this issue is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. (Please note that we will give priority to reports that include a short reproducible example.) If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson
Reopening as there is an open PR related to this issue.
Also seems (callback changes not persisted bur manual are) to affect the single date picker. Is there a workaround? Which is the open PR referred to in the last comment