unfoldadmin / django-unfold

Modern Django admin theme for seamless interface development
https://unfoldadmin.com
MIT License
1.18k stars 114 forks source link

RangeDateFilter does not send ISO date format in query #491

Open VaZark opened 2 weeks ago

VaZark commented 2 weeks ago

I noticed that the RangeDate filters do not work and the results fetched apply only the other filters.

After some digging, it looks like the widget and the query send DD/MM/YYYY instead of the YYYY-MM-DD. This in turn throws an exception ValidationError(['Le format de la valeur «\xa004/06/2024\xa0» n’est pas valide. Le format correct est AAAA-MM-JJ HH:MM[:ss[.uuuuuu]][FH].'])

Manually entering the date in the ISO Format in the input seems to work fine

Fix: Update the query string set to the input to respect the ISO Format (maybe use type="date"?)

VaZark commented 2 weeks ago

Adding "type"="date" makes the widget functional again but we lose the pretty calendar dialog

https://github.com/unfoldadmin/django-unfold/blob/b771b842e571679c90ee00ae6b25667f838c78ae/src/unfold/contrib/filters/forms.py#L98-L104