Requests and questions for "It'about time" Tools

Hello Eric, hello all,

I am using Eric’s really useful set of tools from “It’about time”:
https://tiddlytools.com/timer.htm

Fistly, I have noticed that they are a lot of missing closing widgets (</$reveal>, </$set>, </$vars>, </$wikify>, …) as well as some </div> and @@ inside TiddlyTools/Time/Calendar. I do not know if this can lead to side effects or performance issues. If interested, I can share a version where I have tried to add all the missing items.

Secondly, I have two requests related to the elements display in the calendar:

  1. Could the journal list and indicator be shown when there is a journal existing for a day, event if it was created another day?

  2. Could the created and modified tiddlers list be activated independently (currently there is only one config option to display none or both)?

Thirdly, is it planned to have these tools proposed as a plugin ? The rationale behind this question is that:

  • I prefer to separate the wiki tools inside the “system namespace” from the “operational content” for display, search, …
  • The plugin may help with updates and tweaking. (The shadow mechanism allow to easily come back to the non tweaked version and tweaks can be shown with the diff preview).

BR,

Eskha

By default, when the end of a macro definition is reached, any unmatched widgets, divs, etc. are automatically “closed” by the TWCore parser. Thus, it is not necessary to have lots of matching </$set>, </$vars>, etc., as long as the unmatched widgets are NOT enclosed inside another widget that DOES have a matching </$...>. This is not a problem and has been done deliberately in order to improve readability, reduce the size of the Calendar code, and make it easier to write macros that start with lots of <$set> and <$vars> widgets without worrying about having the correct number of matching close widgets.

This is a bit tricky…

The journal title format is configurable in the $:/ControlPanel. While this setting typically consists of a date format such as “YYYY 0MM 0DD”, it is not a hard-and-fast requirement.

For example, I can set the journal title format to “MMM YYYY” so that all journal entries for the same month and year will be added to the same tiddler, without any date information except for the tiddler’s “created” and “modified” fields.

As an even more extreme example, the journal title format could be something that doesn’t have ANY date formatting codes, such as “My Journal”, so that EVERY journal entry, regardless of the date, is added to a single tiddler.

It should be possible to extend the TiddlyTools Calendar’s journal creation button to add an extra “journaldate” timestamp field using the standard 17-digit zero-padded “system datetime” format – i.e., YYYYMMDD000000000 when creating a new journal, and then use this field value to enable the Calendar to show the journal entry and indicator on the specified “journaldate” instead of the “created” and “modified” dates.

Of course, the journal tiddler would still be listed as a regular “created” or “modified” tiddler using the date(s) specified by the actual created and modified fields of the tiddler. In addition, any journal tiddlers created outside of the Calendar code (e.g., by using the sidebar “new journal” or tiddler “new journal here” buttons, or possibly imported from another document) wouldn’t have the extra “journaldate” field, and thus would still be listed as a journal using the created or modified field values.

I’ll work on this and let you know when I have something for you to try.

It should be possible to add checkboxes under “[x] show tiddler changes” and “[x] show system changes” to separately choose “[x] created” and/or “[x] modified”, with the default being to show both. I suppose it would also be nice to support optional color choices to differentiate them visually in the “color bar”, with the default being to use the same color (i.e., as they currently appear).

Again, this will take some work to accomplish, and I’ll let you know when I have something for you to try.

I am not currently packaging these tools as a plugin, but it is possible to do so. You can even do this yourself with just a few steps! Here’s how:

  1. Begin by dragging the desired TiddlyTools/Time/* tiddlers into your document.
  2. When the $:/Import tiddler is displayed, instead of pressing the “import” button, EDIT THE $:/Import TIDDLER.
  3. You will see a big block of JSON that contains the tiddler definitions.
  4. Change the tiddler title from “$:/Import” to “$:/plugins/TiddlyTools/Time”
  5. Scroll all the way to the bottom of the tiddler editor, and change the value of the plugin-type field from “import” to “plugin”. You can also delete the status field (which has a value of “pending”)
  6. Press “done” (checkmark button) to finish editing.

That’s it. You now have installed shadow tiddler versions of “TiddlyTools/Time/Calendar”, etc. Note that, if you’ve installed anything that uses TiddlyTools/Time/action-timeout.js or TiddlyTools/Time/Ticker (a startup tiddler), you will need to save-and-reload your document for the new shadows to start working.

enjoy,
-e

2 Likes

Well… it turns out that it was actually easier than I had thought!

It just took three relatively small changes to TiddlyTools/Time/Calendar:

  • showday_editjournal_actions(): add journaldate field when creating new journals
  • getjournals(): find journals by matching values in journaldate fields
  • showday(): allow journals to be listed under created/modified

Note that the journaldate field values use UTC (GMT+0) time values, just like the TWCore created and modified fields. As a result, the time stored in the journaldate field may be offset from the local time if you are not in the GMT+0 timezone. This offset will be important if you need to retro-fit existing Journal tiddlers by manually adding journaldate fields.

The easiest way to get the correct ‘journaldate’ values is to use 12:00 noon on the desired date (i.e., enter “YYYYMMDD120000000”). Since timezone offsets are always between -12 hours and +12 hours, using 12 noon avoids any “date wraparound” issues with hand-entered dates.

I’ve posted the update at https://tiddlytools.com/timer.html#TiddlyTools%2FTime%2FCalendar

enjoy,
-e

1 Like

Eric this example reinforces my view the core jounaling should set a journal date field. Appart from allowing any title it allows creaded and modified to remain meaningfull. It also makes it possible to back date or future date journal.

I have modified buttons for this but no access to share them today. I must do a PR.

I belive you already showed us how to use a journal date with your timer tools.

Also the addition of a low overhead date picker.

I’ve successfully split the TiddlyTools Calendar “tiddler changes” handling into two separate items, each with their own color configuration. In the Calendar Settings popup, you can now select checkboxes for “show created” and “show modified”, which act as “parent” options for “include tiddler changes”, “include system changes”, and “include filtered changes” options.

I’ve just uploaded a new update for the TiddlyTools Calendar (and related tiddlers):
https://tiddlytools.com/timer.html

You should get the following tiddlers:
TiddlyTools/Time/Calendar
TiddlyTools/Time/Setup
TiddlyTools/Time/Info
$:/config/TiddlyTools/Time

Give it a try and let me know if everything is working and if it achieves your desired use-case.

There were actually quite a few places that needed small changes to handle the new settings. Here’s a summary of what changed:

TiddlyTools/Time/Calendar

showmonth():

  • changed journalsbg default to OliveDrab
  • replace changesbg with createdbg=“SlateBlue” and modifiedbg=“LightBlue”
  • get showcreated and showmodified flags

showday():

  • use showcreated flag to allow/suppress created list
  • exclude created list from modified list
  • use showmodified flag to allow/suppress modified list
  • removed haschanges

showday_button_colorbar():

  • replace <haschanges> with <created> and <modified>

showday_popup_items():

  • replace <haschanges> with <created> and <modified>

showday_created():

  • change <<showday_items_color changes>> to <<showday_items_color created>>

showday_modified():

  • remove !enlist<created> from filters
  • change <<showday_items_color changes>> to <<showday_items_color modified>>

getjournals():

  • remove unneeded \import TiddlyTools/Time/Timers
  • use [tag[Journal]!has[draft.of]] to get journals list
  • use [enlist<journals>] for improved filter performance

controls_changes():

  • added calendar_showcreated and calendar_showmodified handling
  • set default colors for calendar_created (RoyalBlue) and calendar_modified (LightBlue)
  • show <<controls_colors>> for calendar_created and calendar_modified
  • show checkboxes for calendar_created and calendar_modified
  • changed checkbox labels from “show … changes” to “include … changes”

controls_journals():

  • change default journal color to “OliveDrab”

controls_styles():

  • change default journal color to “OliveDrab”
  • change default created color to “RoyalBlue”
  • change default modified color to “LightBlue”

Info

  • updated Calendar info to show colors for created and modified

Setup

  • updated color settings for journals, created and modified

$:/config/TiddlyTools/Time

  • updated calendar settings to match code changes

-e

1 Like

The above journaldate logic was incorrect. Using UTC time values for the journaldate field resulted in the wrong date being produced if the current time was within the wraparound offset for the local timezone; e.g., here in California, the timezone offset is UTC-8… thus, if a journal tiddler was created after 4pm local time, the resulting time portion of the generated journaldate value would be early in the morning of the next day. But since the date portion of the journaldate value was being calculated separately using the “target” date from the calendar, it was still in the current day, and subsequent conversion to a UTC formatted datetime value caused the combined datetime to shift 8 hours earlier, which moved the result back to the previous day!

To resolve this, the journal timestamp generation now uses local time for all the calculations. This avoids any effects due to automatic adjustments for timezone offsets.

I’ve posted another update at https://tiddlytools.com/timer.html#TiddlyTools%2FTime%2FCalendar

enjoy,
-e

2 Likes

Hello Eric,

Thank you for your, as always, detailed and educational answers and swift update!

Today I learned, two nice tips from you:

  • When the end of a macro definition is reached, any unmatched widgets, divs, etc. are automatically “closed” by the TWCore parser

  • How to easily package any set of imported tiddlers inside a plugin.

I am going to try the new version of your tools and let you know if it achieves my desired use-case.

Many Thanks,

Eskha

1 Like

I invited @EricShulman to repurpose that part of the post into a Tips & Tricks article. :man_shrugging: