django-url-filter
django-url-filter copied to clipboard
ISO datatime format
I am trying to query datetime, but have not been able to get it to work using iso datetime format:
api/meas/?timestamp__lte=2019-06-20T15:20:30×tamp__gte=2019-05-12T15:20:30
Will return no data.
However, it will work if I take the T out:
api/meas/?timestamp__lte=2019-06-20 15:20:30×tamp__gte=2019-05-12 15:20:30
which will convert it to:
api/meas/?timestamp__lte=2019-06-20%2015:20:30×tamp__gte=2019-05-12%2015:20:30
It returns the expected data.
Is there a setting, to enable it to use iso datetime format?
Thanks Jim
Running into the same issue here
when using Django ORM, form field to validate the value is generated by the model field itself - https://github.com/miki725/django-url-filter/blob/bea478fb85fabfffeeb59bfb449afb3700047534/url_filter/filtersets/django.py#L88
for date fields, that will usually be a DateField or DateTimeField which by default honors DATE_INPUT_FORMATS or DATETIME_INPUT_FORMATS and those do not support utc by default. you can add iso format there to add iso support