How to add a special icon for saturday or sunday?

I generate a list of dates from a dictionary-tiddler. With which filter-spell can I find out what day is a saturday to add a special icon?

And how can I filter a list of dates for dates in the future?

Assuming your date values are formatted as “YYYY0MM0DD”:

<$let when=<<now YYYY0MM0DD>> fmt="[UTC]DDD" saturday={{$:/language/Date/Long/Day/6}}>
<$list filter="[<when>format:date<fmt>match<saturday>]">
   {{SaturdayIcon}}
</$list>

Notes:

  • In this example, the value of when is generated via the <<now>> macro. For your purposes, this value would be generated from your dictionary tiddler instead.
  • [UTC]DDD is used to get the day name from the date value. The [UTC] prefix is needed to prevent format:date from applying a timezone offset adjustment to the date input value.
  • You can’t use square brackets within a literal filter operand (i.e., [[UTC]DDD]), so the fmt variable is used as a workaround in order to specify “[UTC]” as part of the date format operand.
  • Getting the day name from $:/language/Date/Long/Day/6 allows the comparison to work for any language setting.

Assuming the index names in your dictionary tiddler are formatted as “YYYY0MM0DD”:

<$let dates="MyDateDictionary" today=<<now "[UTC]YYYY0MM0DD">>>
<$list filter="[<dates>indexes[]compare:date:gt<today>]">
   {{{ [<dates>getindex<currentTiddler>] }}}<br>
</$list>
</$let>

Notes:

  • The $list filter gets all the index names and then filters for only those names that are greater than the current date. This works because “YYYY0MM0DD” is always a strictly ascending value, so all future dates are always greater than the current date.
  • For purposes of this example, the $list output simply shows the index value for each future date. Your specific use-case may be different.

enjoy,
-e

3 Likes

Thank you @EricShulman !
Again a great solution…two great solutions