Lists of dates or date ranges in TiddlyWiki

I’ve been keeping reading notes in TiddlyWiki for a few years now and wanted to add Goodreads-like indicators for different passes through a book. In the general case, you would probably look at it as a list of ranges:

2018-07-12 - 2018-07-19
2022-03-21 - 2022-04-03
etc.

I can’t think of a good way to represent this in fields that I can query through filters. A simple date field for start and finish wouldn’t generalize out to multiple read-throughs as shown above.

Another approach might be to simply include completion dates in a title list, like so:

finished-on: [[2018-07-19]] [[2022-04-03]]

But any attempt to parse out those fields to query for books completed in a range feels like it would be awkward.

Any thoughts on a good way to represent this in a way that can be used with filters?

Let’s assume that each book is a tiddler, tagged with “book” with two fields, started and finished, each of which contains a list of YYYY-0MM-0DD formatted dates.

Now, suppose you want to find all books that were completed between a specified start date and end date. You could write something like this:

<$edit-text field="start"/><$edit-text field="end"/>
<$let start={{!!start}} end={{!!end}}>
<$list filter="[tag[book]]">
   <$list filter="[enlist{!!finished}]" variable="finished">
      <$list filter="[<finished>compare:string:gteq<start>then<finished>compare:string:lteq<end>]" variable="in_range">
         <div><<currentTiddler>> was finished on <<finished>></div>
      </$list>
   </$list>
</$list>

Notes:

  • Because the dates use YYYY-0MM-0DD format, you can use simple text string comparisons to determine if a given date is within a specified <start> and <end> range.
4 Likes