How to display yesterday's date? (And n days ago etc.)

563 views
Skip to first unread message

si

unread,
Feb 20, 2020, 3:18:27 PM2/20/20
to tiddl...@googlegroups.com
Hi all,

I'm aspiring to build a habit tracker with TiddlyWiki with similar functionality to the Android app Loop.

The first thing I wanted to do was list every date for the last week, which I thought would be easy, but immediately hit a wall.

Can anyone point me in the right direction?

Thanks for your help.

Mark S.

unread,
Feb 20, 2020, 4:05:43 PM2/20/20
to TiddlyWiki
The native TiddlyWiki toolkit is rather sparse when it comes to dates. But you could use Jed Carty's date macros:


which I found using the TiddlyWiki Toolmap

Those are javascript-based macros. I have some pure tiddly text macros I wrote with help from Mat or someone very much like him that I could repost if you're a "purist".

Mat

unread,
Feb 20, 2020, 5:28:26 PM2/20/20
to TiddlyWiki
Mark S. wrote:
"from Mat or someone very much like him"

Ain't nobody like Mat!

<:-)

TonyM

unread,
Feb 20, 2020, 6:46:23 PM2/20/20
to TiddlyWiki
SI,

I am having a look a loop, and it may be of some value. I have a sophisticated bespoke todo organizer in tiddlywiki and have dates covered, so if you have any more specific questions I can answer. 

To meet your original request you need to use the days operator with [-7] against the modified or created dates. 

I made a great discovery that almost no one seems to understand but on a given task/habit tiddler I only ever apply a date stamp ie; now, when I do something and it is the list widget that determines if they should appear in a list either for the past or the future. So if the monday tiddler was last date stamped more than -7 days it appears for this monday.

The picaday plugin is important, and sophisticated date calculations are available in Evans Formulae plugin however I can do all I want without it.

Regards
Tony

si

unread,
Feb 21, 2020, 7:07:48 PM2/21/20
to TiddlyWiki
Thanks Tony. It seems that Evan's website is dead (http://evanbalster.com/tiddlywiki/formulas.html). Do you have a copy of his Formula Plugin demo that you could share?

Mark S.

unread,
Feb 21, 2020, 7:46:47 PM2/21/20
to TiddlyWiki
Looks like you might be able to get it from the github site:

Diego Mesa

unread,
Feb 21, 2020, 7:50:27 PM2/21/20
to TiddlyWiki
Joshua Fontany has also updated that plugin on his own:

si

unread,
Feb 22, 2020, 1:01:15 PM2/22/20
to tiddl...@googlegroups.com
Thanks a lot for your help everyone.

So I've managed to get something that kind of works using the the Formulas and MathyThing plugins (thank you to whoever made them!). I've attached it here.

Currently you just tag a tiddler "habit" and it appears on the list. Clicking a button adds an entry in a data tiddler as "yes" or "no".

The code is a total horror show (tons of copy + paste...), but I'm interested interested in constructive criticism on the basic idea. Specifically how the data is stored. I feel that as long as I get that right I can fiddle with everything else in the future when I'm better at using TW.

I would also like to calculate the "percentage success rate" for a given week, so if anyone has any advice on how I could do that it would be super appreciated? In other words I want to look at only the data entries for the last seven days and calculate what percentage of them were set to "yes".
habit-tracker.html

TonyM

unread,
Feb 22, 2020, 8:52:44 PM2/22/20
to TiddlyWiki
Si

I have a code trick for past dates. Use the days operator twice in the one filter to get a tiddler with yesterdays or another past date and then extract the date from that tiddlers date field. It only works if a tiddler with that date field exists but that is often what we want any way.

Regards
Tony

Gabriel Montagné Láscaris-Comneno

unread,
Mar 30, 2023, 7:32:06 PM3/30/23
to TiddlyWiki
I've been using and loving your habit tracker for a while.  Thanks so much for sharing!
Reply all
Reply to author
Forward
0 new messages