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]:Fstands for a field name (default ismodifiedandDis an integer number{positive|negative}. PositiveDmeans 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 innpast days and all tiddlers with a due date after that -
days:due[n]means all tiddlers with a due date innfuture days and all tiddlers with a due date before that - The
!daysmeans those input tiddlers in which fieldFis at leastDdays 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
- download today-yesterday-tomorrow-days-ops.json (2.9 KB)
- open Mehregan — personal knowledge management app (kookma.github.io)
- drag and drop downloaded jSON on Mehregan — personal knowledge management app (kookma.github.io)
- Open
Today, Yesterday and Tomorrow by Days Operatortiddler.
You can test on https://tiddlywiki.com, nut Mehregan is better as it has a Task Manager tool.
References
- https://tiddlywiki.com/#days%20Operator
- How days filter operator works internally by @EricShulman: UTC and Days operator question - #5 by EricShulman


