Error when attempting to filter by date
acrolink opened this issue · 3 comments
I am trying to filter some results by ìnserted_at
date but I am getting this error:
(Ecto.Query.CastError) deps/ex_sieve/lib/ex_sieve/builder/where.ex:13: value
"2017-10-10"in
where cannot be cast to type :naive_datetime in query:
This library is interesting and much less verbose to use than others, I hope development continues :)
There is a problem, complex types like datetime
can't just cast. You should use something like %{ inserted_at_gteq: DateTime.utc_now() }
or parse date by yourself. Anyway, this is a known issue and I'll be appreciated to any help.
1st of all, "2017-10-10" isn't a datetime, its just a date.
I can successfully filter by dates using the canonical ISO8601 format:
q[inserted_at_gt]=2017-10-10T12:00:00
Correct, I close this issue