Tasks due “today” based on Daily Note, not current date?

Things I have tried

Still not working

What I’m trying to do

Just like this topic says, let’s add a couple examples, these are my tasks:

Exam1 2023-02-20
Exam2 2023-02-21
Exam3 2023-02-22

whenever I open the 20th dailynote I want it to show the Exam1 (even if I open said dailynote on the 19th) and same for the 21st, 22nd etc
hence why I’m looking for a way to use Tasks’ date based on the dailynote where its called and not the actual absolute date

I see two variants to get this to work like you intend to. Either use Templater to prepulate the dates based upon your file title (or wherever you get your date from), or using dataviewjs to build the tasks query based upon that date.

Using Templater

Here @egauthier presets some variables, which he then re-uses when building the queries later on in the template. This looks like a neat and easy way to handle this type of query.

Using dataviewjs

Using the same kind of syntax as in the link above, you can do something like:

```dataviewjs
const query = `
not done
due before ${ dv.current().file.day.toFormat("yyyy-MM-dd") }
# you can add any number of extra Tasks instructions, for example:
group by heading
`;

dv.paragraph('```tasks\n' + query + '\n```');
```

Where the ${ ... } is utilising a metadata field to get the date of the file depending on either the file title or the frontmatter field date.

1 Like

Both solution are incredibly smart and working, tysm! <3

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.