[Question] Creating a Memento Mori

Hello all,

I’m looking to create a “Memento Mori”, or a pinned tiddler at the top of my notebook that shows me the number of days I have left, as a bit of a motivator (albeit a bit of a morbid one) to get more things done, and not laze about as much as I do haha

I’d like help with making this, as it’s a bit out of my level of knowledge, but I imagine it could be done by setting a custom created date, and then having it subtract that from a specified amount using JavaScript?

I’m not too sure.

Any help is appreciated!

2 Likes

Do you want an animated coutdown, a static number of days, a grid of square displaying the number of days you got left ? If a static solution is fine with you then it should be easy to make with wikitext

I was just thinking something along the lines of every time I open my notebook, the first tiddler to appear would be “MementoMori” which would update the count from 10,000 days, to 9,999 days, and the only text shown would be how many days would theoretically be left, centered and with a font-size of 1.5rem.

I was thinking that I could probably use whatever allows the newjournal button to pick the date for the title of a tiddler, but I’m not all that familiar with JavaScript.

Hope that gives enough information to work with :sweat_smile:

Ah so it must only decrease when you open your wiki, not according to the current date ?
Then you could use a startup action :

Add the tag $:/tags/StartupAction

In a tiddler with this content :

<$list filter="[[$:/mementomori]get[today]!match<now 0DD0MMYYYY>]">
<$action-listops $field="countdown" $subfilter="subtract[1]"/>
<$action-setfield today=<<now 0DD0MMYYYY>> />
</$list>

Create a field “countdown” in the tiddler $:/mementomori and set it to the starting number you want.

Then you can get the countdown value with {{$:/mementomori!!countdown}} , it should decrease by one every new day you open your wiki.

EDIT: not tested yet

Okay there is a small error, let me fix that

EDIT2: Warning ! I bricked my wiki with this, no idea why. DO NOT USE THIS - I try to figure out what happened

Okay, I think this is because some variable are not set at startup time. This work (do a backup before to be safe) :

\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]

<$action-setfield
$tiddler="$:/mementomori"
countdown={{{[[$:/mementomori]get[today]!match<now 0DD0MMYYYY>]+[[$:/mementomori]get[countdown]add[-1]else[1000]]}}}
/>

<$action-setfield
$tiddler="$:/mementomori"
today=<<now 0DD0MMYYYY>>
/>

I had meant for it to update the count down based on the days date everytime I opened my notebook / edited a tiddler, since I didn’t think there was a way of having it update on it’s own while nothing is changing.

Will this still give the correct countdown if for instance, I don’t open my notebook in a few days?

EDIT: ah ok, glad I didn’t save changes haha

EDIT 2: My original Idea was having a field with “days” set to “100” and then everyday it would change from 100 to 99, then the next day 98, and if I opened my tiddlywiki lets say, 3 days later, it would go from 100 to 97, or something along those lines.

That way I could do like you suggested above and just use {{!!days}} to show the end result

I updated my comment with a working code. This will however only stay accurate if you open your wiki every day, but I think it’s possible to do what you want.

I’ll make an update when/if I find a solution.

Perhaps the days[-100] operator can be used?

I guess it could work, we could generate a range of days and output the index of the first match with the date of $:/mementomori, but I think it’s possible to use format:relativedate[] for that maybe ? The issue is that I dont know how to change the format of the output in number of days …

This works but only up to 10 000 days :

[range[0],[10000]]:reduce[[$:/mementomori]days:modified<index>then<index>]

mh nevermind it only work for tiddlers in the future, I must have made a mistake somewhere

edit : this work

{{{ [range[0],[-10000]]:filter[[JoCat]days:modified<currentTiddler>]+[limit[1]]}}}

I dont know if this helps but I was looking at some posts in stackoverflow on a similar post and found this bit of javascript, and wondered if this could work as a widget (I think thats the correct name)

the result of it seemed pretty close to what I was attempting, and the post can be found @

I don’t have an answer only an intuition.

Perhaps set a date 100 days in the future then somehow compare with today.

It is with this example that I realised if we had a date format that returned days since 1900-01-01 we could do this simple maths, perhaps I am wrong.

Erics timer tools could have something It's About Time! — TiddlyTools: "Small Tools for Big Ideas!" (tm)

1 Like

$ _tesseract_macros_dt.js.tid (1.0 KB)

  1. Download the attached file
  2. Drag and drop into a TEST tiddlywiki
  3. REFRESH
  4. Open a new tiddler and type this <<dt "14-02-2022">>

There are few limitations:

  1. Dates should be mentioned in the format “dd-mm-yyyy” or “dd/mm/yyyy”
  2. Single digit months should be padded. Eg Feb should be 02 and NOT 2
3 Likes

If you want a “vanilla” solution , the code bellow will be accurate for tiddlers up to 82 years old (it’s possible to increase that limit by repeating the pattern in the filter), which should be enough in that case:

\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]

<$let 
filter="[[$:/mementomori]days:created<currentTiddler>]"
days={{{[range[0],[-10000]filter<filter>]~[range[-10000],[-20000]filter<filter>]~[range[-20000],[-30000]filter<filter>]+[first[]]}}}
>

<$action-setfield
$tiddler="$:/mementomori"
countdown={{{[[20080]add<days>]}}}
/>

</$let>

To get the countdown value : countdown = {{$:/mementomori!!countdown}}

The starting value is set at 20080 (i.e 55 years) in the example but you can use whatever number of days you like of course.
The starting date will be the day you created the tiddler $:/mementomori.

1 Like

Both of these are fantastic solutions!

2 Likes

One does not need a countdown for Memento Mori:

<<<
Live each day as if it be your last

//Marcus Aurelius//
<<<