Today, Yesterday and Tomorrow with Days Filter Operator

Demystifying the Days Filter Operator

Mehregan 0.7.5 uses days operator to display tasks of today, tomorrow and yesterday. But how filter tasks based on the due date using pure WikiText?

NOTE: Each circle is a day. Blue circle is today. Orange circle is the day (date) with n days from today.

  • days:F[D]: F stands for a field name (default is modified and D is an integer number {positive|negative}. Positive D means D days in the future from today and negative means D days in the past from today
  • days:due[-n] means all tiddlers with a due date in n past days and all tiddlers with a due date after that
  • days:due[n] means all tiddlers with a due date in n future days and all tiddlers with a due date before that
  • The !days means those input tiddlers in which field F is at least D days in the { future | past }

So, if we can calculate yesterday according to the above figure, then we can use days operator like this days:due[-1]!days:due[1]

Example

\define mytasks(filter, label)
<table>
<tr><th colspan=3>$label$</th></tr>
<$list filter=<<__filter__>> >
<tr>
<td><$link/> </td><td> <$text text={{!!due}}/></td>
<td><$view field=due format=date template="0DDth, MMM, YYYY"/></td>
</tr>
</$list>
</table>
\end

<<mytasks filter:"[tag[Task]!tag[Done]sort[due]]" label:"All Tasks">>
<<mytasks filter:"[tag[Task]!tag[Done]days:due[0]]" label:"Today">>
<<mytasks filter:"[tag[Task]!tag[Done]days:due[-1]!days:due[-1]]" label:"Yesterday">>
<<mytasks filter:"[tag[Task]!tag[Done]days:due[1]!days:due[1]]" label:"Tomorrow">>

This code produces

Demo

  1. download today-yesterday-tomorrow-days-ops.json (2.9 KB)
  2. open Mehregan — personal knowledge management app (kookma.github.io)
  3. drag and drop downloaded jSON on Mehregan — personal knowledge management app (kookma.github.io)
  4. Open Today, Yesterday and Tomorrow by Days Operator tiddler.

You can test on https://tiddlywiki.com, nut Mehregan is better as it has a Task Manager tool.

References

2 Likes

Quiz: :wink:

Q1. What is the filter to show tasks in 3 days from now (e.g. Sep 29, today is 26th)?
Q2. What is the filter to show tasks in past 10 days from now (e.g Sep 16th)?

Hint: Task on that day is asked no all tasks from today and all days before or after!