@tw-FRed… nicely done!
However, there is one small bug in your implementation: when using the unixtime[...format...]
filter operator, the format needs to convert the timestamp to a [UTC]
date output in order to avoid applying an implicit adjustment for local timezone offset.
There are two ways to achieve this:
A) Use a variable to add the [UTC]
prefix to the unixtime
filter operand, like this:
<$let
before="20230317000000000"
timestamp={{{[<before>format:date[TIMESTAMP]]}}}
oneday={{{[[1000]multiply[60]multiply[60]multiply[24]]}}}
format="[UTC]YYYY0MM0DD0hh0mm0ss0XXX"
after={{{[range[1],[3]multiply<oneday>add<timestamp>unixtime<format>] :filter[<currentTiddler>format:date[dddd]compare:integer:lt[6]] +[first[]] }}}
>
note: the format variable is needed because you can’t use a value containing square brackets as as a literal filter operand
OR
B) use the parsedate:unixtime[]
filter operator (with no format operand), which applies a default output format of [UTC]YYYY0MM0DD0hh0mm0ss0XXX
without needing to specify a filter operand at all, like this:
<$let
before="20230317000000000"
timestamp={{{[<before>format:date[TIMESTAMP]]}}}
oneday={{{[[1000]multiply[60]multiply[60]multiply[24]]}}}
after={{{[range[1],[3]multiply<oneday>add<timestamp>parsedate:unixtime[]] :filter[<currentTiddler>format:date[dddd]compare:integer:lt[6]] +[first[]] }}}
>
ref: for the unixtime[...]
or parsedate:unixtime[]
filter operators, you will need to install TiddlyTools/Time/ParseDate. Note that there is an outstanding GitHub ticket to incorporate the parsedate:unixtime[]
filter operator into the TWCore as a new variety of the existing format
operator (see [IDEA] add `format:timestamp[dateformat]` filter operator · Issue #7120 · Jermolene/TiddlyWiki5 · GitHub)
enjoy,
-e