When "sameday" seems to mean "yesterday"

178 views
Skip to first unread message

Jack Baty

unread,
Mar 2, 2021, 12:11:31 PM3/2/21
to TiddlyWiki
I'm guessing this is related to timezone/display issues I've seen mentioned elsewhere, but there's something I don't understand about the `sameday` operator.

Here's the filter I'm working on:

```
<$list filter="[sameday:created[20210302]!is[system]!tag[Journal]]" >
{{||$:/core/ui/ViewTemplate/body}}
</$list>
```

I would expect to see tiddlers I created on 2021-03-02 but I only see those I created on 2021-03-01.

I'm trying to create a "daily" tiddler that simply transcludes the body of all other tiddlers I created that same day. I can cheat and use tomorrow's date in the filter but that feels fragile and that one day TiddlyWiki's date handling will change and they'll all show the wrong tiddlers.

Related, is there a way to substitute the created date of the parent tiddler rather than hardcode it? Be nice to not need to have to manually enter the date each time.

Thanks.

Jack

Mark S.

unread,
Mar 2, 2021, 1:18:08 PM3/2/21
to TiddlyWiki
If you add your offset to the time, then I think you'll get the results you want. That is, if you're in Lima (utc -5), you might use

sameday:created[2021030205]

If you live in the other direction, then the math is harder. If you live in Yekaterinburg (utc +5), then I assume you would have to use:

sameday:created[2021030119]

It would be really great if there was a "local" suffix so you could specify the local time, which is going to make the most sense to anyone living far from the international date line. But I think that the idea was that you would be saying "sameday" as this other tiddler, which will have the appropriate comparison date stamp.

Jack Baty

unread,
Mar 2, 2021, 2:36:56 PM3/2/21
to TiddlyWiki
I'll try the offset, thanks. I'd be happy with a string match on "20210302*", too though, as that's always the day I'm looking for. Half the reason I got out of development was to avoid dealing with timezones :)

Jack Baty

unread,
Mar 13, 2021, 9:48:39 AM3/13/21
to TiddlyWiki
I'm still tinkering with this. 

Thanks to Mark for suggesting adding the Timezone to the sameday filter. That works, but I can't find it documented anywhere. On the DateFormat page "TZD" is mentioned as Timezone format option but in use it renders as "-5:00" not "05". I've found that only "05" works when used in the sameday operator, e.g.:

<<list-links filter:"[sameday:created[2021031305]!is[system]]">>

This works (by works I mean that sameday lists tiddlers created on the, er, same day).

I'm obviously not capable of understanding documentation, because the only way I can find to show a list of tiddlers created on the same day as the current tiddler is something like this:

<$set name="thedate" value=<<now YYYY0MMDD>>>
<<list-links filter:"[sameday:created[$(thedate)$05]!is[system]]">>
</$set>

Note the hardcoded "05". Also, this seems somewhat convoluted. There must be a better way to just include the YYYYMMDD formated date as part of the filter operator without setting a variable, right? And it's probably something obvious and simple that I've overlooked. I get confused around "<<foo>>" vs "$foo$" vs "$(foo)$" vs "[[foo]]" and I cannot figure out how to just put the "now YYYY0MMDD" bit right in the filter.

Jack Baty

unread,
Mar 13, 2021, 9:56:13 AM3/13/21
to TiddlyWiki
Well sorry, I don't actually want <<now>>. I want the created date of the current tiddler, but I think the overall question is the same, which is, how do I show a list of tiddlers created on the same day (date) as the current tiddler. This will eventually be a macro, possibly.

Mark S.

unread,
Mar 13, 2021, 12:22:10 PM3/13/21
to TiddlyWiki
Oh, that's an easier question:

<<list-links "[sameday:created{!!created}]">>

The sameday filter does understand timezones and "sameday", but it doesn't understand about hard-coded values, despite what the documentation says. So it will use your local time to match sameday with an existing tiddler. But not if you do your own (e.g. 20210313)

Jack Baty

unread,
Mar 13, 2021, 2:17:46 PM3/13/21
to TiddlyWiki
Ah, so single curly braces, thanks! 

I'm not sure I'll ever completely understand when to use which variation. :)

Soren Bjornstad

unread,
Mar 14, 2021, 8:38:09 AM3/14/21
to TiddlyWiki
On Saturday, March 13, 2021 at 1:17:46 PM UTC-6 ja...@baty.net wrote:
Ah, so single curly braces, thanks! 

I'm not sure I'll ever completely understand when to use which variation. :)

It's probably simpler than you think, there's just currently nowhere that summarizes it in an understandable form:
  • [[square brackets]] for links / to refer to the name of a tiddler
  • <<angle brackets>> to get the value of variables or macros
  • {{curly braces}} to get the value of fields or tiddlers
Inside a filter expression, you use just one of each. Anywhere else, you use two.

Macros add slight additional wrinkles to the <<angle bracket syntax>>:
  • Inside macros, <<__angle brackets with underscores__>> and $dollar signs$ both refer to a macro parameter, but the dollar signs use text substitution (understanding when to use text substitution and when not to is the only hard part).
  • Inside macros, <<angle brackets>> and $(parenthesized dollar signs)$ both refer to a variable, but the dollar signs use text substitution.
And last, {{{ triple curly braces }}} select one or more tiddlers using a filter, then transclude them – so you can think of it as the “super” or “extra powerful” version of normal double-brace transclusion, since it has one extra brace.

Jack Baty

unread,
Mar 14, 2021, 9:38:56 AM3/14/21
to TiddlyWiki
Soren, this is fantastic, thank you!

I must say that your recent video on YouTube has advanced my understanding of TiddlyWiki faster and farther than several years of muddling about on my own with docs and scattered resources. I'm very much looking forward to Grok TiddlyWiki.

Jack

TW Tones

unread,
Mar 23, 2021, 6:50:03 AM3/23/21
to TiddlyWiki
Jack,

I have attempted to document it all, see here, for what I wish I had when new to TW5

Also time handling has the [UTC] flag where needed. See 
<<now "YYYY0MM0DD hh:mm">>
<<now "[UTC]YYYY0MM0DD hh:mm">>

Tones

Jack Baty

unread,
Mar 23, 2021, 7:49:06 AM3/23/21
to TiddlyWiki
Woah, that'll take a minute to get through, but looks awesome! Thank you.
Reply all
Reply to author
Forward
0 new messages