This is a sidebar History Tab, accepts a filter and displays tiddlers meets that criteria on a monthly basis for selected year. Like April 2014
\define each-month()
<div class="tc-menu-list-item">
<$text text={{{ [[$(year-month)$15]format:date[MMM YYYY]] }}}/>
</div>
<$list filter="[subfilter<__filter__>] :filter[get[modified]prefix[$(year-month)$]] :sort:date[get[modified]else[20000101120000000]]">
<!-- Same Month -->
<div class="tc-menu-list-subitem">
<$link/><!-- - <$view field=modified format=date template="YYYY-0MM-0DD 0hh:0mm:0ss"/> -->
</div>
</$list>
\end
\define recent-monthly(filter, year:"")
<$list filter="[subfilter<__filter__>get[modified]prefix<__year__>format:date[YYYY0MM]unique[]!sort[]]" variable="year-month">
<<each-month>>
</$list>
\end
<!-- implement the UI -->
\define setFilterAction()
<$action-setfield $tiddler=<<stateTid>> $field="filter" $value={{{[<stateTid>get[text]]}}} />
<$action-setfield $tiddler=<<stateTid>> $field="year" $value="" />
\end
\define select-year()
<$select tiddler=<<stateTid>> field=year default="" >
<option value="">All years</option>
<$list filter=<<yearFilter>> >
<option><$text text=<<currentTiddler>>/></option>
</$list>
</$select>
\end
<$let
stateTid= "$:/state/recent-monthly"
defaultFilter= "[!is[system]]"
mainFilter= {{{ [<stateTid>get[filter]else<defaultFilter>] }}}
yearFilter= "[subfilter<mainFilter>get[modified]format:date[YYYY]unique[]!sort[]]"
year= {{{ [<stateTid>get[year]] }}}
currentTiddler=<<currentTab>> ><!-- this last variable is used to let macro works in sidebar tab -->
<$keyboard key="enter" actions=<<setFilterAction>> >
<$edit-text tiddler=<<stateTid>> default=<<defaultFilter>> placeholder="enter a valid filter like [tag[HelloThere]]" tag=input class="w-50" focus=yes type=search/>
</$keyboard>
<<select-year>>
<$list filter="[<stateTid>get[text]!match<mainFilter>] +[limit[1]]" variable=null>
<$button actions=<<setFilterAction>> >Set filter</$button>
</$list>
<!--results -->
<div class="tc-search-results">
<small>Total results for <code><$text text=<<mainFilter>> /></code>: <$count filter=<<mainFilter>> /> matches</small>
<$macrocall $name="recent-monthly" year=<<year>> filter=<<mainFilter>> />
</div>
</$let>
Screencast
To give a try
-
download History.json (2.4 KB)
-
drag and drop to https://tiddlywiki.com
-
From sidebar, open the History tab
-
Type your filter and press enter
-
Select the year
Important: You need to press enter after typing the filter! This is only for the sake of better performance.
Credits
EDIT Code updated on 2022.08.27