DatePickerRange initial values


I have a DatePickerRange control on a Dash page. I want to set the initial start_date to be 2 weeks ago and the end_date to be today every time the page loads (the user can then of course modify those dates).

Is there any way to do this without utilising callbacks to set the initial values?

e.g. something like:


Currently the above example will not recompute the values of these functions when the page loads - so tomorrow, the initial values will be a day out of date!

The question is for all initial values of dash controls.


If app.layout is a function, then it will be called on every page load. Inside that function you can do a See “Updates on page load” here: Live Updates | Dash for Python Documentation | Plotly

1 Like