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?
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.
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 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 …
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 @
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:
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.