feat: add date math for filters #1086

Merged
konrad merged 8 commits from feature/relative-time into main 2022-03-27 20:35:07 +00:00
Owner

Description

This PR adds support for relative dates in filters, similar to the ones from grafana or elasticsearch.

In short, it allows you to filter for due dates by passing in dates like "now - 7d" to get a date from 7 days ago.

This is a very powerful addition for saved filters as they will allow you to create filters for all kinds of stuff where you previously only could use fixed dates. Now you can for example create a saved filter for "all tasks this week".

Frontend PR: vikunja/frontend#1342

Checklist

  • I added or improved tests
  • How (where) to document this properly?
# Description This PR adds support for relative dates in filters, similar to the ones from [grafana](https://grafana.com/docs/grafana/latest/dashboards/time-range-controls) or [elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/common-options.html#date-math). In short, it allows you to filter for due dates by passing in dates like "now - 7d" to get a date from 7 days ago. This is a very powerful addition for saved filters as they will allow you to create filters for all kinds of stuff where you previously only could use fixed dates. Now you can for example create a saved filter for "all tasks this week". Frontend PR: https://kolaente.dev/vikunja/frontend/pulls/1342 # Checklist * [x] I added or improved tests * [x] How (where) to document this properly?
konrad added 3 commits 2022-01-08 21:14:39 +00:00
Author
Owner

I think this definitely needs docs in the frontend.

I think this definitely needs docs in the frontend.
konrad added 2 commits 2022-01-08 21:19:18 +00:00
continuous-integration/drone/pr Build is passing Details
9eb1520a0c
fix: lint
Member

This is really cool!
Is it be possible to add an offset to the dates?

This is really cool! Is it be possible to add an offset to the dates?
Author
Owner

Is it be possible to add an offset to the dates?

You mean something to get the tasks for this month or the next month?

> Is it be possible to add an offset to the dates? You mean something to get the tasks for this month or the next month?
Member

I was thinking of that I always hate it when after 00:00 systems say that the new day bagan (which it obviously did) but my day - in the sense of awake period - didn't end yet.

We had somewhere a discussion about a system setting that configures this.

I guess this might be a location where we want to use the same number

I was thinking of that I always hate it when after 00:00 systems say that the new day bagan (which it obviously did) but my day - in the sense of awake period - didn't end yet. We had somewhere a discussion about a system setting that configures this. I guess this might be a location where we want to use the same number
Author
Owner

I think that could work with this PR. Something like now/d+3h should result in "3:00 am today" so using that as a from date (and the equivalent for to) should give you all tasks from 3am today to 3am tomorrow.

I think that could work with this PR. Something like `now/d+3h` should result in "3:00 am today" so using that as a `from` date (and the equivalent for `to`) should give you all tasks from 3am today to 3am tomorrow.
First-time contributor

Maybe it's worth to have a look at all the possible dynamic and recurring filters Todoist implements if it helps in some away with this 😁

https://todoist.com/help/articles/introduction-to-filters

Thank you so much !

Maybe it's worth to have a look at all the possible dynamic and recurring filters Todoist implements if it helps in some away with this 😁 https://todoist.com/help/articles/introduction-to-filters Thank you so much !
Author
Owner

What todoist does is a really interesting concept, thanks for the pointer. Would love to do something similar to this at some point, this PR "only" provides date math though. I think it's a step in the direction of what todoist does.

What todoist does is a really interesting concept, thanks for the pointer. Would love to do something similar to this at some point, this PR "only" provides date math though. I think it's a step in the direction of what todoist does.
konrad force-pushed feature/relative-time from ae3a740763 to fbc856eb6c 2022-03-27 15:57:11 +00:00 Compare
konrad added 2 commits 2022-03-27 19:22:42 +00:00
continuous-integration/drone/pr Build is passing Details
c19158f964
chore: go mod tidy
konrad merged commit 0a1d8c9404 into main 2022-03-27 20:35:07 +00:00
konrad deleted branch feature/relative-time 2022-03-27 20:35:07 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: vikunja/vikunja#1086
No description provided.