unfoldadmin / django-unfold

Modern Django admin theme for seamless interface development

Home Page:https://unfoldadmin.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RangeDateFilter does not send ISO date format in query

VaZark opened this issue · comments

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"?)

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

widget=forms.DateInput(
attrs={
"placeholder": _("From"),
"class": "vCustomDateField " + " ".join(INPUT_CLASSES),
}
),
)

Here are the date filters which are working without any issues:

https://demo.unfoldadmin.com/admin/formula/race/

Would you mind to create a new repo where it is possible to reproduce the issue?