Date and time of the TiddlyWiki File

Hello Tiddly Talkers,

I searched here and the internet but I didn’t found excactly what I am looking for.
In my “Welcome” Tiddler I want to display the date and time of the TiddlyWiki File on the server.
Something like:

This version is from <$view field="FileDate" format="date" template="DDD, DD. MMM YYYY, 0hh:0mm"/>

Is there something available?

Thx in advance
Stefan

Try this:
https://tiddlytools.com/#TiddlyTools%2FTime%2FLastModified.js

Usage:
<<lastmodified>> returns document.lastModified string in browser-native format
<<lastmodified "...">> returns document.lastModified string using specified TWCore date format

Example:
This file was last updated on <<lastmodified "DDD, DD. MMM YYYY">>
returns:
This file was last updated on Monday, 15. May 2023

1 Like

I don’t think there would be an easy way to do that, especially with a stand-alone wiki.

But this might get you close to what you want: displaying the modification time of the most recently changed tiddler:

<$list filter="[all[tiddlers+shadows]!has[draft.of]] +[!sort[modified]limit[1]]">
This version is from 
<$view field="modified" format="date" template="DDD, DD. MMM YYYY"/>
</$list>

Latest Modified Date.json (307 Bytes)

Update

Or, as usual, do what Eric says! :smiley:

How to install this on a standalone Wiki?
I exported the Tiddler from tiddlytools and imported it to my TiddlyWiki but it seems to be some changes necessary.

Because its a javascript macro, you need to save-and-reload before it can be used.

Note: The titles of all tiddlers on TiddlyTools are links (see $:/ControlPanel > Settings > Tiddler Titles, "Display tiddler titles as links"). This allows you to easily import the tiddler simply by dragging-and-dropping the tiddler title into your open TiddlyWiki.

-e

1 Like

You can do this without additional javascript:

This version is from <$text text={{{ 
[all[tiddlers]]
:sort:date:reverse[get[modified]]
+[first[]get[modified]format:date[DDD, DD. MMM YYYY, 0hh:0mm]] 
}}}/>

When loaded a tiddlywiki file has a date/time. Each subsequent save will update its Time. We have discussed previously logging the last saved time and using this to determin the time since last saved. Idealy we could autosave a neglected tab after 15 to 30mins. This last saved time is a proxy for them file date/time.

1 Like

While it might be used as a rough approximation of the document.lastModified value, the modification timestamp of the last tiddler change is NOT the same as the timestamp of the file itself. Consider: suppose I make a tiddler change to a local TiddlyWiki file and save that file, and then several hours (or even days) later, I upload this file to a server (e.g., TiddlyHost). The timestamp of the online file will be dramatically different from the modification timestamp of the last tiddler change.

Note also that your suggested filter can be written much more succinctly, like this:

[all[tiddlers]get[modified]!sort[]first[]format:date[DDD, DD. MMM YYYY]]

Notes:

  • There is no need to sort the tiddler TITLES. We only need to sort the actual modification timestamp values.

  • The ! preceding the sort[] filter operator sorts in reverse (descending) order… and since the modification timestamps all use TWCore 17-digit fomat (YYYY0MM0DD0hh0mm0ss0XXX), the default alphanumeric sorting is sufficient, without need to do any date conversion preprocessing before sorting.

  • The first[] filter operator isn’t strictly needed, since the filtered transclusion used as the text=... parameter value in the $text widget will always return just the first resulting list item. However, it is still useful in that it avoids extra format:date[] processing overhead for all the other modification timestamps.

-e

2 Likes