Why i cant select today? (DatePicker) (on server)

Hi,
I have a dashboard and im refreshing my dashboard livestream. And im running this dashboard on linux server. After I run this on server, I can see new data currently, and I have a counter, and counter is increasing every hour, there is no problem about that.

But after 1 day I cant select today, I can see counter, I have new data but I cant select today on datepicker. Actually I think I did everything right, can you say where problem comes from?

My datepicker is smth like this:

                    dcc.DatePickerSingle(id='gun-sec1',
                                        min_date_allowed=datetime.date(2021, 1, 13),
                                        max_date_allowed=datetime.datetime.today().date(),
                                        initial_visible_month=datetime.datetime.today().date(),
                                        date=datetime.datetime.today().date(),
                                        display_format='YYYY-MM-DD'
                                        ),

Hi,

Apologies for resurfacing this post after so much time, but the same thing happened to me in an application and it could be a nice idea to have an answer for it.

The issue is because you are defining max_date_allowed as today’s date. This value will be evaluated when the application process start and will never update again, unless you redeploy it or start a new process.

My workaround was to write a very small clientside callback to be triggered by another component and that recalculates this value for the current date. The component that triggers it is less important, as the callback is evaluated after every page refresh.

Hope that this helps someone facing the same issue!

1 Like