plotly / dash

Data Apps & Dashboards for Python. No JavaScript Required.
https://plotly.com/dash
MIT License
21.14k stars 2.04k forks source link

DatePickerRrange accepts start_date which is less then min_date_allowed #2671

Open ognjengrubac-tomtom opened 10 months ago

ognjengrubac-tomtom commented 10 months ago

The following datepicker range will accept start_date although it is less then min_date_allowed.

dcc.DatePickerRange(
id='picker-range',
min_date_allowed=date(2023, 8, 1),
start_date=date(2023, 7, 1),
)
alexcjohnson commented 10 months ago

Good point. Not 100% obvious what the correct solution is though. I suppose it's clear that min_date_allowed (and max_date_allowed) should take precedence over start_date and end_date, but we can't put logic like this at the Python level - that code is all auto-generated so doesn't know about logic like this, anyway it wouldn't be able to catch situations where any of these props is set by a callback.

So we'd need to catch it in JS, then there are two questions:

@T4rk1n curious your thoughts on this, particularly about whether there's something we could do with validation like this and still have it marked as an initial call. I think something similar is going on in https://github.com/plotly/dash/issues/2668