Refreshing the Start Date Everyday for DatepickerSingle

I currently have a web application that’s deployed on a server and since its only made to run once and its set to be live, the start date always remains the same (the same day the application was hosted/updated). How can I dynamically change the start date filter option when the user loads the application the next day?

I have already implemented the suggestion dash had in its documentation of putting all the html divs and dropdown components in a function which I also named “serve_layout”

I’m also calling serve_layout by adding the line: app.layout = serve_layout.

Even after I do this, the date isn’t changing based on the day the application is loaded in the user’s browser.

Check this out (https://dash.plot.ly/live-updates)…especially the last paragraph.

1 Like

Thanks ill look into it. Have you done anything specific with this?

Not yet. I am relatively new to Dash (been using it for about 9 months) and the app I am developing currently doesn’t have a need for live updates. But their implementation seems pretty straight forward. I’m also hoping Dash’s user docs improve as while their website is full of useful information, it’s sometimes hard to find the answer…in those cases Google has been my friend (and looking thru other’s Dash apps)

Hi, actually I think the easiest solution is to create a callback that sets the date. Since callbacks are run on every page load (and input change of course) you can return pythons datetime.now() as callback return value that will change every day

Has anyone figured out a better solution for this during the last year? Having another callback just for this seems a bit excessive.

I managed to do it based on the question below:
https://stackoverflow.com/questions/57651154/dash-python-changing-default-date-dynamically-everyday