tq-obsidian icon indicating copy to clipboard operation
tq-obsidian copied to clipboard

Feature request: Enable relative dates in queries?

Open taylorbanks opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. If I want to see tasks from today and yesterday, I have to manually edit my query each day.

Describe the solution you'd like I would love to be able to use relative dates (like "select-day: yesterday") so that I can embed a query in a template that will always show me today's tasks and yesterday's tasks, without me having to manually edit the select-day property to reflect yesterday's actual date.

Describe alternatives you've considered I played around with ways to accomplish this, but haven't been successful. If such a mechanism already exists, please pardon the noise!

taylorbanks avatar Jul 30 '21 19:07 taylorbanks

I'm getting this to work for the current date with the following block in my daily note template:

_templates_/daily
... other junk

```tq
select-day: {{date:YYYY-MM-DD}}
no-due: true
sort: score
```

... more other junk

This generates notes like this:

daily/2021-08-27
... other junk

```tq
select-day: 2021-08-27
no-due: true
sort: score
```

... more other junk

It's certainly not as clean as select-day: today but it is working--when the daily note is created, Obsidian parses the date variable in the template and outputs the correct date string in the generated note. It doesn't work for dates other than the daily note's date though (it does work "in the future" when creating daily notes with the calendar plugin).

I'm running Obsidian on Windows and OS X, if that helps.

flyinggrizzly avatar Aug 27 '21 08:08 flyinggrizzly