docspell icon indicating copy to clipboard operation
docspell copied to clipboard

Support `today` in queries for custom fields with type date

Open Snify89 opened this issue 2 years ago • 3 comments

I have some custom fields with the "date" type. When I query "due>=today", I get results based on today and all future relevant documents.

However with custom fields the behavior seems to be like this: "f:customfield>=today" => no results at all "f:customfield<=today" => results in past and future items (just like "f:customfield:*")

A workaround is to use "hardcoded/dynamic" dates like this: "f:customfield>=2022-07-15" (whereas 2022-07-15 is today)

I haven't tested other custom fields with other datatypes. But it might be worth a look, if there's a similar issue.

Maybe it's an issue of interpreting "today" rather than the operator...

Snify89 avatar Jul 15 '22 07:07 Snify89

Thanks for reporting!

eikek avatar Jul 15 '22 13:07 eikek

So I had a look :) The thing is that date comparisons are not supported for custom fields atm. The comparison is always done alphanumerically. And since dates are stored as ISO strings, all of them are <= today and none is >= then. The docs don't mention this fact explicitly. This will turn now into a feature request and documentation bug 😄.

eikek avatar Nov 19 '22 10:11 eikek

I'd simply like to second this feature request. It would be very useful to me as well. Thanks for looking into this!

davidclemens avatar Nov 24 '22 19:11 davidclemens