The edit-date
macro is here: TiddlyTools/Time/EditDate
However, the issue raised by @Rob_Jopling is not caused by my TiddlyTools macro. It can be replicated simply by using one of the examples from https://tiddlywiki.com/#WidgetMessage: tm-new-tiddler
<$button>
<$action-sendmessage $message="tm-new-tiddler" title="This is newly created tiddler" tags="OneTag [[Another Tag]]" text=<<now "Today is DDth, MMM YYYY">>/>
New Tiddler
</$button>
- Press the above
$button
to create “This is newly created tiddler”
- Add some extra content in the text field
- Press “done” to finish editing
- Press the above
$button
again
- Note that it automatically replaces the existing tiddler (the extra content you added is GONE!). This is why it does not show the “tiddler already exists” warning.
You can avoid this “overwrite” situation by using the $action-createtiddler
widget instead of the tm-new-tiddler
message in your NewJournalEntry()
macro, like this:
\define NewJournalEntry()
<$action-createtiddler $basetitle={{!!date}} tags="Journal" date={{!!date}}>
<$action-sendmessage $message="tm-edit-tiddler" $param=<<createTiddler-title>>/>
</$action-createtiddler>
\end
When invoked, the $action-createtiddler
widget will create a new tiddler with the chosen date (e.g. “2024-11-23
”). If the specified tiddler title already exists, a number will be automatically added to the end of the title (e.g., “2024-11-23 1
”, “2024-11-23 2
”, etc). The tm-edit-tiddler
message will then open it for editing. If, while editing, you remove this extra number from the title, the “tiddler already exists” message will appear and when you press done to finish editing, you will be asked to confirm “Do you wish to overwrite…”
Another alternative would be to use:
\define NewJournalEntry()
<% if [{!!date}is[missing]] %>
<$action-sendmessage $message="tm-new-tiddler" title={{!!date}} tags="Journal" date={{!!date}}/>
<% else %>
<$action-sendmessage $message="tm-edit-tiddler" $param={{!!date}}/>
<% endif %>
\end
When invoked, this code will either create a new tiddler with the specified title, or edit the existing tiddler if it already exists. Any content previously entered into that tiddler will be retained.
enjoy,
-e