First, I hope you aren’t using tiddlers from It's About Time! — TiddlyTools: "Small Tools for Big Ideas!" (tm), which is very old has not been updated since Sept 2022! All current TiddlyTools add-ons are hosted directly in https://TiddlyTools.com. Specifically, for your usage, you need to copy TiddlyTools/Time/EditDate and TiddlyTools/Time/Calendar
Now, on to your problem…
Try this:
Booking for:<br><$edit-text field=booking-by/>
<hr>
Start date:
<$macrocall $name="edit-date" field="start-date" type="button" format="YYYY0MM0DD"/>
<$view field=start-date format=date template="[UTC]0DD/0MM/YYYY"/>
End date:
<$macrocall $name="edit-date" field="end-date" type="button" format="YYYY0MM0DD"/>
<$view field=end-date format=date template="[UTC]0DD/0MM/YYYY"/>
<hr>
<$let new-entry={{{ [{!!start-date}addsuffix[-]addsuffix{!!end-date}addsuffix[;]addsuffix{!!booking-by}] }}}
lf={{{ [charcode[10]] }}}
revised-text={{{ [{TF Bookings}!is[blank]] [<new-entry>] +[join<lf>] }}}>
<$button> Add booking
<$list filter="[{!!start-date}!is[blank]then{!!end-date}!is[blank]then{!!booking-by}!is[blank]]" variable="has-input">
<$action-setfield $tiddler="TF Bookings" text=<<revised-text>> tags="events" type="text/plain"/>
<$action-deletefield booking-by start-date end-date/>
</$list>
</$button>
</$let>
<hr>
''Bookings''
{{TF Bookings}}
Notes:
- The
$view
widgets that show the entered dates use templates starting with “[UTC]”. This prevents the displayed dates from being adjusted by your current timezone offset. Note that this is only a display issue and does NOT affect the stored start-date
and end-date
field values.
- The
lf
variable uses the charcode[10]
filter operator so it contains a literal newline (aka, “line feed”) character (ASCII code 10).
- The
revised-text
variable assembles any existing content from “TF Bookings” with the newly generated new-entry
value, joined with a literal newline (NOT a space!). Note the test for !is[blank]
… this ensures that if the existing “TF Bookings” tiddler content is empty (or the tiddler is missing), then the revised-text
will not get a leading newline, and will just be the value of new-entry
.
- The actions within the “Add booking”
$button
widget are enclosed by a $list
widget that ensures that all three needed inputs have been provided (i.e., are not blank). Note the use of variable=none
… this prevents the $list
widget from altering the value of currentTiddler
within the body of the widget.
- To update the text content of the “TF Bookings” tiddler, we use
$action-setfield
… NOT $action-listops
which incorrectly resulted in the text value being stored as a space-separated, bracketed list rather than individual lines of text (this is where the erroneous square brackets came from!)
- The
$action-setfield
also sets type="text/plain"
so that the text contents of the “TF Bookings” tiddler can be displayed as regular text without being “wikified”.
- The
$action-setfield
also sets tags="events"
so that the events listed in the “TF Bookings” tiddler can be selected for display in the TiddlyTools/Calendar.
- The
$button
also invokes an $action-deletefield
widget to reset the booking-by
, start-date
, and end-date
input fields. Note that no $tiddler
parameter is specified for this widget, so that it defaults to the currentTiddler
, which is where your inputs have been stored. This is why we used the variable=none
in the enclosing $list
widget above.
Finally, in order for your “TF Bookings” entries to appear in the TiddlyTools Calendar, you will need to ensure that you have used the Calendar Settings popup to select the “TF Bookings” tiddler in the “Events and Timelines” section.
That should do it. Let me know how it goes…
enjoy,
-e