TiddlyTools/timer.html - Calendar feature improvements

940 views
Skip to first unread message

Eric Shulman

unread,
Oct 2, 2020, 9:57:07 PM10/2/20
to TiddlyWiki
Hi all,

In addition to the "configuration re-factoring" announced here: https://groups.google.com/d/msg/tiddlywiki/CYHa9EDVQa4/A4TW5LedCgAJ, I've also made some more feature improvements to the TiddlyTools/Time/Calendar settings:

You can now manage all Calendar related settings directly from the Settings ("gear") icon shown in the Calendar interface.  This includes the ability to enable, disable, or edit individual Holiday/Event lists (including imported .ics (iCal) data files) as well as options for showing/hiding "Tiddler Changes" for normal tiddlers, system tiddlers ($:/config, $:/state, $:/temp, etc.) , or filtered tiddlers (using standard TiddlyWiki filter syntax).

You can also adjust all of the Calendar Styles (background, foreground, today, events, changes, and numbers) by clicking on the "palette" button in the upper right of the "Settings" popup.

These changes make it possible to install the TiddlyTools/Time/Calendar into any of your TiddlyWiki files by drag-and-drop of a single tiddler, without any needing the separate TiddlyTools/Time/Setup interface for controlling the Calendar settings.

enjoy,
-e







Atronoush Parsi

unread,
Oct 3, 2020, 12:12:54 AM10/3/20
to tiddl...@googlegroups.com
Great improvements! More consistency! and Better control!

Thank you Eric.

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/c7435cd6-b9f3-4cae-9798-5a26f984a5b0o%40googlegroups.com.

TW Tones

unread,
Oct 3, 2020, 3:19:31 AM10/3/20
to TiddlyWiki
Eric,

Thanks for continuing to innovate. I will review the latest version again, soon for my purposes and any issues. 

One question, I am happy for a yes or no answer, I will find out how later if its clear.
  • Can I easily introduce a separate start-date and end-date fields to tiddlers and have the start only as a milestone and somehow reflect when both are used as a range?
  • I am keen to make use of created and modified dates independently, but also these separate dates fields, including a separate journal-date.
  • I expect you have addressed this in some way but just asking;
Why
  • I am hoping to import a range of family history events, anniversaries and Period in time like the start and end of a particular trip.
  • Some of these will be "fuzzy", perhaps in the first half of the year, so I will ;look to find additional methods.
Thanks in advanced, for this wonderful calendar date and time platform.

Regards
Tones

Eric Shulman

unread,
Oct 3, 2020, 4:39:59 AM10/3/20
to tiddl...@googlegroups.com
On Saturday, October 3, 2020 at 12:19:31 AM UTC-7, TW Tones wrote:
One question, I am happy for a yes or no answer, I will find out how later if its clear.
  • Can I easily introduce a separate start-date and end-date fields to tiddlers and have the start only as a milestone and somehow reflect when both are used as a range?
  • I am keen to make use of created and modified dates independently, but also these separate dates fields, including a separate journal-date.
The short answer is (currently) "no".  Here's a bit more info:
  • There are two kinds of date info being used:  TWCore created/modified fields and "events"
  • In the showday() macro, the tiddlers with created/modified dates on that day are identified by:
<$set name="haschanges" filter="[enlist<tiddlers>sameday<thisdate>] [enlist<tiddlers>sameday:created<thisdate>] [<journalTitle>is[tiddler]]">
  • Similarly, in the showday_popup() macro, the tiddlers with created/modified dates on that day are identified by:
<$set name="created"  filter="[enlist<tiddlers>!title<journalTitle>sameday:created<thisdate>sort[created]]">
<$set name="modified" filter="[enlist
<tiddlers>!title<journalTitle>sameday:modified<thisdate>!sort[modified]]">
  • In the getevents() macro, "events" are loaded in from two types of tiddlers:
    1. text tiddlers tagged with "events", containing one event per line of text, using format: "YYYYMMDD;Description"
    2. text tiddlers with an ".ics" suffix, using the iCalendar standard VEVENT text record format (see https://en.wikipedia.org/wiki/ICalendar)
  • For performance reasons, the results of getevents() are cached on a monthly basis, in from showgrid(), via:
<$wikify name="events" text=<<getevents>>>

  • Then, in showday(), the event descriptions for that date only are filtered from the cached events list, by calling on matchevents():
<$wikify name="todays_events" text=<<matchevents>>>
  • Originally, matchevents() used a regexp[] filter, which allowed definition of events that spanned a range (i.e. "....MM(DD|DD|DD|D)" would identify an event that occurs over the same 4-day period every year). However, using regexp[] resulted in VERY LONG processing times (in excess of 6 seconds) when displaying a 365-day annual calendar.  So, matchevents() was simplified to use removeprefix[...] to find event descriptions for the current <date>, like this:
<$vars annual_date={{{ [<date>split[]rest[4]join[]addprefix[....]] }}}>
<$list filter="[enlist<events>removeprefix<date>] [enlist<events>removeprefix<annual_date>]">
   <$text text="[["/><$text text={{{ [<currentTiddler>removeprefix[;]] }}}/><$text text="]]"/><br>
</$list>
  • Without the use of regexp[] filtering, general patterns such as "....MM(DD|DD|DD|DD)", are no longer supported, and annual dates (starting with "....") are handled with removeprefix[], rather than using a regexp[] match.
  • In any case, matchevents() only works from the cached events list, so any code to scan for specific event dates or date ranges stored in tiddler fields (e.g., "start-date" and "end-date") would have to be added to the getevents() macro.
  • I will do some experiments with scanning all tiddlers for "start-date" and "end-date", but at present, the getevents() code doesn't do this.  If I can make it work without excessive performance issues, I'll let you know.
-e

Eric Shulman

unread,
Oct 3, 2020, 8:13:47 AM10/3/20
to TiddlyWiki
On Saturday, October 3, 2020 at 1:39:59 AM UTC-7, Eric Shulman wrote:
The short answer is (currently) "no".  Here's a bit more info:

Success!  I've just updated the http://TiddlyTools.com/timer.html Calendar to support showing "events" for tiddlers that have a "start-date" (and optional "end-date") field!

Here's some tech notes on how it's done:
  • In the showday() macro, the tiddlers with created/modified dates on that day are identified by:
<$set name="haschanges" filter="[enlist<tiddlers>sameday<thisdate>] [enlist<tiddlers>sameday:created<thisdate>] [<journalTitle>is[tiddler]]">
  • Similarly, in the showday_popup() macro, the tiddlers with created/modified dates on that day are identified by:
<$set name="created"  filter="[enlist<tiddlers>!title<journalTitle>sameday:created<thisdate>sort[created]]">
<$set name="modified" filter="[enlist
<tiddlers>!title<journalTitle>sameday:modified<thisdate>!sort[modified]]">

I realized that I could make things just a bit more efficient by only doing the "sameday:created" and "sameday:modified" filters ONCE instead of twice!

Thus, showday() now does the <$set name="created"...> and <$set name="modified"...> code, and then computes the "haschanges" flag using:
<$set name="haschanges" filter="[<created>!match[]] [<modified>!match[]] [<journalTitle>is[tiddler]]">

Then, showday_popup() just references the already computed <<created>> and <<modified>> variables, instead of recomputing them.

  • In the getevents() macro, "events" are loaded in from two types of tiddlers:
    1. text tiddlers tagged with "events", containing one event per line of text, using format: "YYYYMMDD;Description"
    2. text tiddlers with an ".ics" suffix, using the iCalendar standard VEVENT text record format (see https://en.wikipedia.org/wiki/ICalendar)
getevents() now also defines events from tiddlers that have "start-date" fields (using YYYYMMDD format).  If there is an "end-date" field, it also defines an event for that date as well... and, if it has a "description" field, it uses that text to show the event in the calendar (otherwise it just uses the tiddler's title as the event description).  Here's the added code in getevents():

<$list filter="[all[]has[start-date]]">
   ``[[``{{!!start-date}};{{!!title}}{{{ [{!!description}!match[]then[: ]] }}}{{!!description}}|{{!!title}}``]]``
<br>
   <$list filter="[
<currentTiddler>get[end-date]]" variable="end_date">
     
<!-- TBD: add entries for each date in between start-date and end-date -->
      ``[[``{{!!end-date}};{{!!title}}{{{ [{!!description}!match[]then[: ]] }}}{{!!description}}|{{!!title}}``]]``
<br>
   </$list>
</$list>
Note that currently, this code creates an event for the "end-date" only if there is also a "start-date", and does NOT yet create events for any of the dates in between.  (Thus, the "TBD" comment in the above code)

Note also how the generated "event" item includes "|{{!!title}}" at the end.
This allows the display of the event in showday_popup() to link to the source tiddler, rather than linking to the full description text.
Here's the changed code from showday_popup():
      <$list filter="[enlist<todays_events>]">
         <$vars event_text={{{ [
<currentTiddler>split[|]first[]] }}}>
         <$vars event_link={{{ [
<currentTiddler>split[|]rest[]]  }}}>
         <$link to={{{ [
<event_link>!match[]else<event_text>] }}} tooltip="view tiddler"><$text text=<<event_text>>/></$link>
         </$vars>
         </$vars>
      </$list>

I still need to add a new checkbox option for enabling/disabling the "start-date/end-date" handling.  Currently, any tiddlers with "start-date" will *always* be shown as events, even if the Calendar is configured to turn off *all* "Holiday/Events".

Lastly, I also haven't added support for recognizing "journal-date" fields, but that will also be coming soon.

enjoy,
-e

Eric Shulman

unread,
Oct 3, 2020, 2:35:07 PM10/3/20
to TiddlyWiki
 Another update to the http://TiddlyTools.com/timer.html Calendar to support showing "events" for tiddlers that have a "start-date" (and optional "end-date") field...

getevents() now generates events for all dates in a range from "start-date" to "end-date" inclusive.  see getevents_range() .  The code is a little bulky and I'm not sure about processing overhead, especially for larger ranges of dates.  I will probably re-visit this code to optimize performance, but for now... it works, and that's the main thing.

As previously noted:
I still need to add a new checkbox option for enabling/disabling the "start-date/end-date" handling.  Currently, any tiddlers with "start-date" will *always* be shown as events, even if the Calendar is configured to turn off *all* "Holiday/Events".

Eric Shulman

unread,
Oct 3, 2020, 9:31:27 PM10/3/20
to TiddlyWiki
On Saturday, October 3, 2020 at 11:35:07 AM UTC-7, Eric Shulman wrote:
 Another update to the http://TiddlyTools.com/timer.html Calendar to support showing "events" for tiddlers that have a "start-date" (and optional "end-date") field...

getevents() now generates events for all dates in a range from "start-date" to "end-date" inclusive.  see getevents_range().

getevents_range() has been renamed getevents_timeline() and has been refactored to provide some code cleanup and performance improvements.

"range events" are now referred to in the Calendar interface (and documentation) as "Timeline Events".
I've also added a Calendar Settings checkbox option for showing/hiding Timeline Events.
This checkbox will only appear when there is at least one Timeline event defined.

Still to be added: support for recognizing "journal-date" fields as special instances of Journal tiddlers

enjoy,
-e

TW Tones

unread,
Oct 3, 2020, 9:41:41 PM10/3/20
to TiddlyWiki
Eric,

Thanks so much.

Rather than specifically addressing journal-date, is there any chance of simply nominating one or more date fields, for which if they are equal to the calendar date they cause the default highlight and appear listed in the drop down on that date?
  • The idea is simply to be able to integrate any other solution using a tiddlywiki serial number date in a date field to appear on the calendar.
  • The start and end date as you implemented is a range which is a fundamental need in some cases, thank you so much for implementing that. 
  • It seems to me the ability to place on the calendar tiddlers with any nominated date field on the same day is another fundamental need, although less complex than start and end dates.
I must find the timeline plugin that actually allowed on to see dates and date range on a scrollable and zoomable time line. it could be reviewed to check your solution can work with that plugin, not to reinvent the wheel but make use of it.

Regards
Tones

Eric Shulman

unread,
Oct 4, 2020, 5:13:35 AM10/4/20
to tiddl...@googlegroups.com
On Saturday, October 3, 2020 at 6:41:41 PM UTC-7, TW Tones wrote:
Rather than specifically addressing journal-date, is there any chance of simply nominating one or more date fields, for which if they are equal to the calendar date they cause the default highlight and appear listed in the drop down on that date?
  • The idea is simply to be able to integrate any other solution using a tiddlywiki serial number date in a date field to appear on the calendar.
  • The start and end date as you implemented is a range which is a fundamental need in some cases, thank you so much for implementing that. 
  • It seems to me the ability to place on the calendar tiddlers with any nominated date field on the same day is another fundamental need, although less complex than start and end dates.
start-date/end-date and journal-date handling are VERY similiar.  In fact, a journal entry is really just a special case of a timeline entry without a specified "end-date" (i.e., a single day event), which the timeline code already handles.

So... rather than writing redundant code for handing "journal-date" or any other desired fieldname, I just made the timeline "start-date" fieldname configurable, so that you can easily enter a different fieldname instead of "start-date".  Thus, the Calendar can now display timeline and journal events using "start-date" or "journal-date" or any fieldname you like.  To change the fieldname, just view the Calendar settings and click on the gear icon next to the "Timelines and Journals" entry in the "Events" list.

http://TiddlyTools.com/timer.html now includes a "SampleTimelineEvent" (with a start-date field) and "SampleJournalEntry" (with both start-date and journal-date fields).

The SampleJournalEntry is set to 20201001 (October 1st)
The SampleTimelineEvent is set for 20210717 through 20210725 (July 17-25, 2021)

enjoy,
-e

Anthony

unread,
Oct 5, 2020, 6:32:51 AM10/5/20
to TiddlyWiki
Hi Eric,

What a project - I can barely keep up!

I'm thinking about using the calendar option for an 'On This Day' project and I have a few questions:
1. When one uses the '....MMDD' date format then the event (e.g. birth) is also included for years before that event - I can't quite decide whether it's okay for this to happen so I'm wondering whether there's a way to include a 'start date' for a re-occurring event?
2. I thought it would be appropriate to use a field to store, let's say, date of birth or death and then use some 'mechanism' to put the event into an events tagged tiddler. I'm still learning about what 'mechanism' might do this and I may be completely misunderstanding the use of fields but is this a reasonable approach?
3. Asociated with 2. I note that an events tagged tiddler is Plain text(text/plain) type and that, of course, just displays the text as written. It seems it's okay to use other types, which means a 'mechanism' does something useful but, again, is this a reasonable approach for an events tagged tiddlet?

Apologies, I'm still vey much learning how TW works and hope these queries aren't too dumb.

Many thanks for any comments,

Anthony

Eric Shulman

unread,
Oct 5, 2020, 8:54:48 AM10/5/20
to tiddl...@googlegroups.com
On Monday, October 5, 2020 at 3:32:51 AM UTC-7, Anthony wrote:
1. When one uses the '....MMDD' date format then the event (e.g. birth) is also included for years before that event - I can't quite decide whether it's okay for this to happen so I'm wondering whether there's a way to include a 'start date' for a re-occurring event?


The "event tiddler" format is a single tiddler containing multiple events listed as one event per line of text.
and the "start-date/end-date" fields are only used when creating individual "Timelines and Journals" tiddlers.

As you noted, the "....MMDD" date format is for annual events, regardless of the year.
You can, of course, specify repeating birthdays events using multiple "YYYYMMDD" entries.

Thus:
....0724;Eric's Birthday
vs.
20200724;Eric's Birthday
20210724;Eric'
s Birthday
20220724;Eric's Birthday
20230724;Eric'
s Birthday
20240724;Eric's Birthday

2. I thought it would be appropriate to use a field to store, let's say, date of birth or death and then use some 'mechanism' to put the event into an events tagged tiddler. I'm still learning about what 'mechanism' might do this and I may be completely misunderstanding the use of fields but is this a reasonable approach?

You could use a button gets "birthdate" and "deathdate" values from fields, and then generates an "events tiddler".

Here's something I just cooked up:
\define birthday_tiddler() BirthdayList
\define lifetime()         [range[$(birthyear)$,$(deathyear)$]]
\define makebirthdays()
<$vars newline="
">
<$vars birthyear={{{ [{!!birthdate}split[]first[4]join[]] }}}>  <!-- YYYY -->
<$vars birthdate={{{ [{!!birthdate}split[]rest[4]join[]]  }}}>  <!-- MMDD -->
<$vars deathyear={{{ [{!!deathdate}split[]first[4]join[]] }}}>  <!-- YYYY -->
<$set name="deathyear" value=<<deathyear>> emptyValue={{{ [<birthyear>add[100]] }}} >
<$button> add birthdays to <$text text=<<birthday_tiddler>>/>
   <$list filter=<<lifetime>> variable="year">
      <$vars event={{{ [<year>addsuffix<birthdate>addsuffix[;Birthday: ]addsuffix<currentTiddler>addsuffix<newline>] }}}>
         <$list filter="[<birthday_tiddler>!search:text:literal<event>]">
            <$action-setfield tag="events" type="text/plain" text={{{ [{!!text}addsuffix<event>] }}}/>
         </$list>
      </$vars>
   </$list>
</$button>
\end
<$list filter="[<currentTiddler>has[birthdate]]"> <<makebirthdays>> </$list>

Place the above code into a tiddler, "MakeBirthdays", tagged with "$:/tags/ViewTemplate".
Then, create a tiddler, e.g, "John Smith" with a "birthdate" field containing a YYYYMMDD
value and an optional "deathdate" field containing another YYYYMMDD value

Because "MakeBirthdays" is tagged with $:/tags/ViewTemplate and "John Smith"
contains a "birthdate" field, this will automaticaly show the "add birthdays" button at
the bottom of the "John Smith" tiddler.  When you press the button, it will generate
the birthday events based on the "birthdate" and "deathdate" values and add them
to the "BirthdayList" tiddler

Here's how the code works:
1) First, we define a few "utility" macros:
* birthday_tiddler() is just a convenience so we can easily change the output tiddler name
* lifetime() is used to construct the filter syntax needed to generate a range of years, based on the birthdate and deathdate field values

2) Next, the makebirthdays() macro does the work:
* $vars newline=... defines a variable for inserting a literal newline into the output tiddler.  Note the linebreak in between the quotes is important!
* $vars birthyear=... extracts the YYYY from the "birthdate" field of the current tiddler
* $vars birthdate=... extracts the MMDD from the "birthdate" field of the current tiddler
* $vars deathyear=... extracts the YYYY from the "deathdate" field of the current tiddler
* $set name="deathyear" ... does a "fixup" if there is no defined "deathdate" value, using birthyear+100 as a fallback value
* $button starts the definition of the button
* The first $list filter=<<lifetime>> ... loops through the range of years from birthyear to deathyear
* $vars event=... constructs the event syntax output for the current year
* The second $list searches the birthday_tiddler text to make sure that the event hasn't already been added
* $action-setfield appends the event syntax for the current year to the current content of the output tiddler

3) Following the macro:
* $list filter="[<currentTiddler>has[birthdate]]" limits the <<makebirthdays> button to only appear in tiddlers that have a non-blank birthdate field

Hope this all makes sense!

enjoy,
-e

Anthony

unread,
Oct 5, 2020, 12:45:18 PM10/5/20
to TiddlyWiki
Thanks so much for this Eric, it's really helpful. Once I get my head around your script/code, with the help of your notes, I'll have a better understanding of how to do this sort of thing... I'll be playing with this for a while!

Take care,

Anthony

Eric Shulman

unread,
Oct 6, 2020, 12:27:31 AM10/6/20
to TiddlyWiki
On Monday, October 5, 2020 at 9:45:18 AM UTC-7, Anthony wrote:
Thanks so much for this Eric, it's really helpful. Once I get my head around your script/code, with the help of your notes, I'll have a better understanding of how to do this sort of thing... I'll be playing with this for a while!

As a result of writing the example code, I started thinking about the "timelines" use start-date/end-date to define "single-day events" and "multi-day events"... and I realized that I could also use the same functionality to define "annual repeating events" (i.e., birthdays, anniversaries, etc.).

Unlike an annual event defined using "....MMDD" in an Event List, the new "Timeline" annual events can be limited to a specified span of years.  To specify an annual repeating Timeline event, you provide an 8-digit YYYYMMDD start-date, but only a 4-digit YYYY end-date.  This is used to indicate that the Timeline event is not a "multi-day event", but just a single-day event that repeats each year until the end-date year is reached.  I've also added a separate "date-type" field that can be used to force annual date handling even if the end-date has a full 8-digit YYYYMMDD value.  When the date-type field is set to "annual", the code simply ignores the "MMDD" portion of the end-date, and generates annual events instead.

start-date=YYYYMMDD, end-date=none is a *single day event*
start-date=YYYYMMDD, end-date=YYYY is an *annual single day event*
start-date=YYYYMMDD, end-date=YYYYMMDD is a *multi-day event*
start-date=YYYYMMDD, end-date=YYYYMMDD, date-type="annual" is also an *annual single day event*

In addition to adding support for annual Timeline events, I've also completely re-factored the rest of the Timeline code so you can now configure multiple Timelines in the same file!

* All Timelines are tagged with "timeline" to identify them as Timelines.
* A Timeline is composed of a set of separate event tiddlers, each tagged with the name of one or more Timelines to which they belong.
* Each event tiddler has start-date/end-date fields with optional date-type="annual" and caption fields.
* Each Timeline also has an optional "timeline-fields" that defines a pair of custom date fieldnames that can be used in addition to the default "start-date" and "end-date" field names.

Thus, you can define tiddlers for people that use "birth-date" and "death-date" as the Timeline fields.

To see this in action, take a look at http://tiddlytools.com/timer.html#SampleTimeline, and click on the "SampleTimeline" tag pill.  You will see Timeline event tiddlers listed for "Albert Einstein", "Marie Curie" and "Carl Sagan".  These are "annual timeline events" that mark each persons birthdate, from the year of their birth through the year of their death.  In addition, there's also two tiddlers, "Summer Science Symposium 2020" and "Summer Science Symposium 2021" that are also part of the SampleTimeline, but
are "multi-day timeline events" rather than "annual timeline events".

Lastly, note that in the Calendar Settings, there are now checkboxes to enable/disable each Timeline set of events with a single click,  This allows you to easily set the Calendar display to only view a one selected Timeline at a time, rather than having the Timeline events mixed in with the other kinds of events.

I know this all may seem like a lot of complicated features, but hopefully the interface I've created makes it all seem straightforward and useful.

enjoy,
-e

Anthony

unread,
Oct 13, 2020, 9:28:55 AM10/13/20
to TiddlyWiki
These are very interesting additions Eric and I'm in the process of having a play with things - apologies for the delay in commenting; I've been away without any connectivity and also had teaching.

So far, I've experienced difficulty using an end-date field in my local 'on this day' project - whenever I include one everything slows down and I get an alert that 'a web page is slowing down your browser' and I have to reload the page to regain control. This seems to happen even if I set the end-date to tomorrow. I guess this is something I've done to slow it down and I need to undertake further tests with your default 'It's About Time!' page.

I also note that using a start-date and end-date in a timeline generates events for each year in the 'view all events' list of the Calendar settings. I guess this is inevitable but it means there are many events generated for each person or subject and, even in your project, there are over 300 events. Will this slow things down?

For an 'on this day' project, it seems one would not want either a birth or a death event (say) to be listed in any year before that date so for Albert Einstein (Born: March 14, 1879; Died: April 18, 1955), no birth event prior to and including 1878 and death event prior to and including 1954. But each event would show thereafter for perpetuity. If I understand correctly, events would only display between the start-date and end-date when the fields are set. I appreciate an 'on this day' calendar would usually display just the current year so I'm wondering whether there is a way to remove options to go backwards or forwards in time so only the current year is shown. However, it might be interesting to see events change as the year changes - going backwards there are likely to be fewer events to display.

For information, I'm using Windows 10/Firefox 81.0.1.

Many thanks for all your work on this project, I'm learning quite a bit as I tinker around.

Take care,

Anthony

Eric Shulman

unread,
Oct 13, 2020, 11:20:53 AM10/13/20
to TiddlyWiki
On Tuesday, October 13, 2020 at 6:28:55 AM UTC-7, Anthony wrote:
So far, I've experienced difficulty using an end-date field in my local 'on this day' project - whenever I include one everything slows down and I get an alert that 'a web page is slowing down your browser' and I have to reload the page to regain control. This seems to happen even if I set the end-date to tomorrow. I guess this is something I've done to slow it down and I need to undertake further tests with your default 'It's About Time!' page.

The start-date is always an 8-digit YYYYMMDD.  If the end-date is also 8-digits, it indicates a continuous event occurring *every day* from the start-date through the end-date.  If end-date is only 4-digits, then it indicates an *annual* one-day event, from the start-date, through the year of the end-date.  To use an 8-digit end date but force an annual event instead of a continuous event, you must also set a "date-type" field to "annual".
 
I also note that using a start-date and end-date in a timeline generates events for each year in the 'view all events' list of the Calendar settings. I guess this is inevitable but it means there are many events generated for each person or subject and, even in your project, there are over 300 events. Will this slow things down?

Yes.  This does tend to slow things down.  There's probably a few things I can try to help reduce the processing overhead for "Timeline" handling when there are lots of dates involved.  One possibility is to limit the generation of Timeline Events to only match the current year.  While this might help somewhat, it also *adds overhead* to the date generation processing, since it means checking the year value of each Timeline Event before it is added to the list.

For an 'on this day' project, it seems one would not want either a birth or a death event (say) to be listed in any year before that date so for Albert Einstein (Born: March 14, 1879; Died: April 18, 1955), no birth event prior to and including 1878 and death event prior to and including 1954. But each event would show thereafter for perpetuity. If I understand correctly, events would only display between the start-date and end-date when the fields are set.

For "on this day" events, I would use an "Event List", which is just a single tiddler, tagged with "events", containing text that lists events, one per line, using "YYYYMMDD;description"

Thus, for Albert Einstein, you would add two lines:
18790314;Albert Einstein born
19550418;Albert Einstein dies
and if you want to also highlight Einstein's birthday *in perpetuity*, you could add a third line:
....0314:Albert Einstein's birthday

However, if you want to highlight Einstein's birthday *only during his lifetime*, you could add lines for every year from 1880 to 1955, like this:
18790314;Albert Einstein born
18800314;Albert Einstein's birthday (1 year old)
18810314;Albert Einstein'
s birthday (2 years old)
18820314;Albert Einstein's birthday (3 years old)
18830314;Albert Einstein'
s birthday (4 years old)
... etc ...
19550314;Albert Einstein's birthday (76 years old)
19550418;Albert Einstein dies

Alternatively, to highlight his birthday during his lifetime, you could define a "Timeline" tiddler and associated "Timeline Event" tiddler, such as the one included in the timer.html samples
where the "Albert Einstein" Timeline Event tiddler (tagged with "SampleTimeline") has fields start-date=18790314, end-date=19550418, AND date-type="annual"

I appreciate an 'on this day' calendar would usually display just the current year so I'm wondering whether there is a way to remove options to go backwards or forwards in time so only the current year is shown. However, it might be interesting to see events change as the year changes - going backwards there are likely to be fewer events to display.

See my note above.  At some point, I'd very much like to get a copy of your file with lots of dates, so I could use it to experiment with performance enhancements to the code.

-e

Eric Shulman

unread,
Oct 13, 2020, 2:52:02 PM10/13/20
to TiddlyWiki
On Tuesday, October 13, 2020 at 8:20:53 AM UTC-7, Eric Shulman wrote:
Yes.  This does tend to slow things down.  There's probably a few things I can try to help reduce the processing overhead for "Timeline" handling when there are lots of dates involved.  One possibility is to limit the generation of Timeline Events to only match the current year.

PERFORMANCE UPDATE!

getevents() now takes params "yyyy" and "mm" which are passed down to
getevents_listed(), getevents_ics(), getevents_timeline_annual(), and getevents_timeline_range()

These macros now only return events that match the specified "yyyy" and "mm" values.
This reduces the processing load for each month by about 50-60% because the showday() macro
no longer has to filter through ALL events.

This is particularly true when testing with the "Science Timeline" enabled, which adds over 300
events to the calendar (birthdays for Marie Curie, Albert Einstein, Carl Sagan, and Neil deGrasse Tyson).

Before the performance improvements, displaying a yearly calendar with all events
enabled took about 4-5 seconds.  It now takes about 2 seconds!

Note that in the "view all events" list in Calendar Settings, it still shows ALL enabled events.  This
is because it invokes getevents() without any YYYY and MM values, so the filters simply default
to matching all dates.

Anthony: please get the latest update from http://tiddlytools.com/timer.html and let me know how it goes...

enjoy,
-e

dieg...@gmail.com

unread,
Oct 13, 2020, 5:29:40 PM10/13/20
to TiddlyWiki
Eric,

Im bringing this back up as you suggested. This tool puts me in mind to create a "heatmap calendar" like github has:


which shows how many "pushes" a user has done over a period of time. With these tools, I was thinking it would be great to have a heatmap calendar for filtered tiddlers whose creation or modification date fall within a specified range.

I am just saying this idea out loud, not suggesting you should implement it as part of your tool.

Thanks again for all your hard work.

Diego

Anthony

unread,
Oct 14, 2020, 5:12:39 AM10/14/20
to TiddlyWiki
Ah, okay, I didn't fully appreciate the use of a four- or eight-digit end-date but that's clarified it for me. Thank you.

I have been playing around with an event list and had decided this may be the way to proceed. At the moment I only have about 10 people in my project as I didn't want to have too many tiddles to change each time I did something new or different. When it's a bit more extensive I'll gladly send you the file - is it best to this Group or just you personally?

Many thanks for all your work on this,

Anthony

danraymond

unread,
Oct 17, 2020, 12:51:30 AM10/17/20
to TiddlyWiki
Eric,

Is there a way to colour each calendar? I was trying to get shool holidays to show different to public holidays. They are different ics tiddlers.

Eric Shulman

unread,
Oct 17, 2020, 4:28:15 AM10/17/20
to TiddlyWiki
On Friday, October 16, 2020 at 9:51:30 PM UTC-7, danraymond wrote:
Is there a way to colour each calendar? I was trying to get school holidays to show different to public holidays. They are different ics tiddlers.

I've just updated http://TiddlyTools.com/timer.html to add "custom event colors" to the Calendar.

To define a custom event color, edit an EventList tiddler, Timeline tiddler, or .ics tiddler and
add a field named "eventcolor" containing any valid CSS color value (i.e., #rrggbb, #rgb, or X11 color name).

If events from different tiddlers with custom colors occur on the same day,
the color that is used will come from the first event listed for that day.

enjoy,
-e

Eric Shulman

unread,
Oct 17, 2020, 6:23:33 AM10/17/20
to TiddlyWiki
BUG FIXES:
1) when more than one event on the same day had a custom color, neither custom color was being used.
2) when copying an EventList, Timeline, or .ics tiddlers (using the Calendar Settings panel) the "eventcolor" custom color field wasn't being copied
3) also when copying, internal data values were written into the copied events, resulting in corrupted description text for those events.

Re-import TiddlyTools/Time/Calendar to get the fixes.

-e


enjoy,
-e

Eric Shulman

unread,
Oct 17, 2020, 8:42:32 AM10/17/20
to TiddlyWiki
 
Another update to http://TiddlyTools.com/timer.html:

Events for a given calendar day are now sorted by the name of the EventList/Timeline/.ics tiddler in which they are defined.

This makes it possible to prioritize the use of custom event colors by changing the names of the defining tiddlers.

For example, if you want your SchoolEvents color to take precedence over any other custom event colors,
you could rename "SchoolEvents" to "1SchoolEvents".  Note that you can use the caption field on the tiddler
to "hide" it's real name, so it could still appear as "School Events" in the Calendar interface.

Also note that this sorting extends to the event description text as well.  Thus, if there are several events
on the same day that are all defined in the same EventList/Timeline/.ics tiddler, they will now be sorted
alphabetically by description.

enjoy,
-e

Hans Wobbe

unread,
Oct 17, 2020, 11:01:04 AM10/17/20
to TiddlyWiki
Eric:

Your focused and persistent dedication to these Timer functions is amazing!  I have not appreciated the value of good time support this much since my early days with APL back in the 1970s.

It is completely transforming the way I Navigate through TiddlyWiki files.

Thank you very much!!

Best,
Hans

Ste

unread,
Oct 17, 2020, 3:31:15 PM10/17/20
to TiddlyWiki
Hi Eric, 
This is probably a silly question, I've not really had a look at this in detail but have admired the updates 
from a distance. 
But... Can your stuff be used with/ work with http://kixam.github.io/TW5-visjsTimeline/?

Ste

Eric Shulman

unread,
Oct 17, 2020, 6:59:17 PM10/17/20
to tiddl...@googlegroups.com
On Saturday, October 17, 2020 at 12:31:15 PM UTC-7, Ste wrote:
This is probably a silly question, I've not really had a look at this in detail but have admired the updates 
from a distance. 
But... Can your stuff be used with/ work with http://kixam.github.io/TW5-visjsTimeline/?

Surprisingly... YES!!

After you install the TW5-visjs plugin, you can show, for example, the SampleTimeline ("Science Timeline")
by writing:
<$visjstimeline filter="[tag[SampleTimeline]]" startDateField="timeline.start" endDateField="timeline.end" format="YYYYMMDD"/>

Note: by default, the TW5-visjs plugin uses the tiddlers created/modified times for the timeline. It also uses alternative fieldnames "timeline.start" and "timeline.end". In contrast, TiddlyTools "Timeline Event" tiddlers were using "start-date" and "end-date". However, I like the "timeline.start" and "timeline.end" fieldnames better, so I changed TiddlyTools/Time/Calendar (and the SampleTimeline event tiddlers) field names:
"start-date" -> "timeline.start"
"end-date" -> "timeline.end"
"date-type" -> "timeline.type"

Other than those changes to the field names, everything works in both my Calendar, and the TW5-visjs Timeline.


enjoy,
-e

Eric Shulman

unread,
Oct 17, 2020, 7:59:26 PM10/17/20
to TiddlyWiki
On Saturday, October 17, 2020 at 3:59:17 PM UTC-7, Eric Shulman wrote:
However, I like the "timeline.start" and "timeline.end" fieldnames better, so I changed TiddlyTools/Time/Calendar (and the SampleTimeline event tiddlers) field names:
"start-date" -> "timeline.start"
"end-date" -> "timeline.end"
"date-type" -> "timeline.type"


If you've already created some Timeline Event tiddlers using the old fieldnames, here's a little utility code to change the existing fieldnames with one click of a button:
BEFORE:<hr>
<$list filter="[has[start-date]]">

</$list>

<$button> convert timeline fieldnames
<$list filter="[has[start-date]]">
   <$action-setfield timeline.start={{!!start-date}} timeline.end={{!!end-date}} timeline.type={{!!date-type}} /
>
   
<$action-deletefield $tiddler=<<currentTiddler>> start-date end-date date-type />
</$list>
</
$button>

AFTER
:<hr>
<$list filter="[has[timeline.start]]">

</$list>

-e

Anthony

unread,
Oct 18, 2020, 4:44:28 AM10/18/20
to TiddlyWiki
Hi Eric,

I've been wondering whether it would be possible to identify 'event collections' so this is great.

Unfortunately, my 'On This Day' calendar seems to have stopped working. Using my TW with a version of TiddlyTools/Time/Calendar from 12th October 2020 at 4:39am works fine but having updated to yesterday's version (17th October 2020 at 1:22pm) none of my events now show on the calendar. This is probably my fault as the tidders tagged with the event tag are not of type 'text/plain' so that I can get the 'date;detail' information from tiddler fields using, for example, the following where the information is taken from a tiddler for a particular person in the project:

....<$view tiddler="Frances Hamilton Arnold (1956-)" field="birth-date" format="date" template="0MM0DD" />;Frances Hamilton Arnold (1956-)

My reasoning for doing this is so that I only need to input details once in one place, using fields and then it's available elsewhere in the project. Maybe this is a bad approach but seemed logical to me. If I create a tidder tagged with the event tag making it 'text/plain' then it seems to work fine. I can send you the file to your gmail account if that helps?

Do I need to re-think the way I do this?

As ever, many thanks for this fantastic project and it's spurred me on to try to learn more and extend my TW abilities.

Take care,

Anthony

Ste

unread,
Oct 18, 2020, 5:46:24 AM10/18/20
to TiddlyWiki
Wow! Ty Eric!!! 

Eric Shulman

unread,
Oct 18, 2020, 6:50:07 AM10/18/20
to tiddl...@googlegroups.com
On Sunday, October 18, 2020 at 1:44:28 AM UTC-7, Anthony wrote:
Unfortunately, my 'On This Day' calendar seems to have stopped working. Using my TW with a version of TiddlyTools/Time/Calendar from 12th October 2020 at 4:39am works fine but having updated to yesterday's version (17th October 2020 at 1:22pm) none of my events now show on the calendar. This is probably my fault as the tidders tagged with the event tag are not of type 'text/plain' so that I can get the 'date;detail' information from tiddler fields using, for example, the following where the information is taken from a tiddler for a particular person in the project:

....<$view tiddler="Frances Hamilton Arnold (1956-)" field="birth-date" format="date" template="0MM0DD" />;Frances Hamilton Arnold (1956-)

My reasoning for doing this is so that I only need to input details once in one place, using fields and then it's available elsewhere in the project. Maybe this is a bad approach but seemed logical to me. If I create a tidder tagged with the event tag making it 'text/plain' then it seems to work fine. I can send you the file to your gmail account if that helps?

Up until now (see below!) an EventList tiddler (tagged with "events") had to contain ONLY lines of plain text, each with a format of: "YYYYMMDD;Description" (or "....MMDD;Description" for "perpetual" annual events).  This was because the tiddler text content was just read into the Calendar code as-is, so it couldn't use wiki syntax to generate output that, when *rendered*, appears to produce the desired text format.

However... with just TWO lines of code, the Calendar now allows EventList tiddlers to generate their content, using any syntax that results in "YYYYMMDD;Description" output, which is then processed as before!

For the technically-minded, I changed this line in getevents_listed() from this:
<$list filter="[{!!text}splitregexp[\n]trim[]!match[]]" variable="line">
to this:
<$wikify name="eventdata" text={{!!text}} mode="inline">
<$list filter="[
<eventdata>splitregexp[\n]trim[]!match[]]" variable="line">

With this new Calendar code in place, you can now create an EventList tiddler (tagged with "events"), containing wiki syntax like this:
<$list filter="[has[birth-date]]">
   <$view field="birth-date" format="date" template="YYYY0MM0DD" />;<
<currentTiddler>><br>
</$list>

or, for perpetual annual birthdays:
<$list filter="[has[birth-date]]">
   <$view field="birth-date" format="date" template="....0MM0DD" />;<
<currentTiddler>><br>
</$list>

To use this new ability, just import the latest update of TiddlyTools/Time/Calendar from http://TiddlyTools.com/timer.html

Let me know how it goes...

enjoy,
-e




 

Anthony

unread,
Oct 20, 2020, 11:18:03 AM10/20/20
to TiddlyWiki
Hi Eric,

Many thanks, that's cool and also sorted something I was going to try to do later - generate the list in an event tagged tiddler automatically rather than entering each event for each individual manually.

Strange you say that wiki syntax shouldn't have worked as it seems to have done for me at least since a version of  http://TiddlyTools.com/timer.html on 3rd October. However, it only worked if I did't use the text/plain tiddler type.

However, I've noticed something else that happened originally, then was 'fixed' but is happening again. When I click on a day in the calendar display where there's an event, say a birth, that's included in an events tagged tiddler called 'Born on this Day' then the link goes to a tiddler called 'Born on this Day: Frances Hamilton Arnold (1956-)' (say), which does not exist. Rather I'd hope it went to a tiddler called 'Frances Hamilton Arnold (1956-)' that does exist and has all the data that generates all the events etc. for that individual. This is what happened before the latest two-line change to getevents_listed().

Sorry to keep throwing things back to you and I hope my comments are useful. I'm excited about this as it's getting easier and more efficient to generate a calendar with all the events having just put the data into the tiddler for an individual just once.

Take care,

Anthony

Eric Shulman

unread,
Oct 20, 2020, 12:11:00 PM10/20/20
to tiddl...@googlegroups.com
On Tuesday, October 20, 2020 at 8:18:03 AM UTC-7, Anthony wrote:
However, I've noticed something else that happened originally, then was 'fixed' but is happening again. When I click on a day in the calendar display where there's an event, say a birth, that's included in an events tagged tiddler called 'Born on this Day' then the link goes to a tiddler called 'Born on this Day: Frances Hamilton Arnold (1956-)' (say), which does not exist. Rather I'd hope it went to a tiddler called 'Frances Hamilton Arnold (1956-)' that does exist and has all the data that generates all the events etc. for that individual. This is what happened before the latest two-line change to getevents_listed().

As you've noted, an event is linked to a tiddler using "EventList: description text" as the title.  This is so that if the same description is used in separate EventLists, they don't link to the same tiddler.

This way, if I have two EventLists, "Bob's Events" and "Jim's Events", where each contains an event like: "....MMDD;My Birthday", they will produce separate links to "Bob's Events: My Birthday" and "Jim's Events: My Birthday".

Fortunately, there is already a way to override this default handling: you can provide a link to specific tiddler title by adding "|TiddlerTitle" following the description text

Thus, if you enter the following into "Born on this Day":
....MMDD;Frances Hamilton Arnold (1956-)|Frances Hamilton Arnold (1956-)
it will always link to "Frances Hamilton Arnold (1956-)", regardless of the name of the EventList in which it is defined.

The event will still show the EventList title in the Calendar's date popup, but will use the specified title for the link.

For a generated EventList, you could write:
<$list filter="[has[birth-date]]">
   <$view field="birth-date" format="date" template="....0MM0DD" />;<
<currentTiddler>>|<<currentTiddler>><br>
</$list>

Note that there is one exception to the automatic EventList prefix handling:

Events listed in TiddlyTools/Time/Events (the default EventList), do NOT add the prefix.  Thus, in that tiddler, if you enter:
...0202;Ground Hog Day
it will just link to a tiddler named "Ground Hog Day" rather than "TiddlyTools/Time/Events: Ground Hog Day"

enjoy,
-e

Anthony

unread,
Oct 20, 2020, 12:45:41 PM10/20/20
to TiddlyWiki
Ah, I see what's going on there... great, thank you.

Sorry... there's more... I've been playing with dates and noticed that if a date prior to 2 December 1847 is entered in a field (say birth-date) then it's displayed as the previous day... so 18471202 is fine but 18471201 shows as 30th November 1847 (using <Sview with appropriate formatting). Is there something in the TW handles dates?

As ever, thanks for all your assistance and enhancements.

Take care,

Anthony

On Tuesday, 20 October 2020 at 17:11:00 UTC+1 Eric Shulman wrote:
On Tuesday, October 20, 2020 at 8:18:03 AM UTC-7, Anthony wrote:
However, I've noticed something else that happened originally, then was 'fixed' but is happening again. When I click on a day in the calendar display where there's an event, say a birth, that's included in an events tagged tiddler called 'Born on this Day' then the link goes to a tiddler called 'Born on this Day: Frances Hamilton Arnold (1956-)' (say), which does not exist. Rather I'd hope it went to a tiddler called 'Frances Hamilton Arnold (1956-)' that does exist and has all the data that generates all the events etc. for that individual. This is what happened before the latest two-line change to getevents_listed().

As you've noted, an event is linked to a tiddler using "EventList: description text" as the title.  This is so that if the same description is used in separate EventLists, they don't link to the same tiddler.

This way, if I have two EventLists, "Bob's Events" and "Jim's Events", where each contains an event like: "....MMDD;My Birthday", they will produce separate links to "Bob Event's: My Birthday" and "Jim Event's: My Birthday".

Fortunately, there is already a way to override this default handling: you can provide a link to specific tiddler title by adding "|TiddlerTitle" following the description text

Thus, if you enter the following into "Born on this Day":
....MMDD;Frances Hamilton Arnold (1956-)|Frances Hamilton Arnold (1956-)
it will always link to "Frances Hamilton Arnold (1956-)", regardless of the name of the EventList in which it is defined.

The event will still show the EventList title in the Calendar's date popup, but will use the specified title for the link.

Eric Shulman

unread,
Oct 20, 2020, 1:56:13 PM10/20/20
to tiddl...@googlegroups.com
On Tuesday, October 20, 2020 at 9:45:41 AM UTC-7, Anthony wrote:
Ah, I see what's going on there... great, thank you.

Sorry... there's more... I've been playing with dates and noticed that if a date prior to 2 December 1847 is entered in a field (say birth-date) then it's displayed as the previous day... so 18471202 is fine but 18471201 shows as 30th November 1847 (using <Sview with appropriate formatting). Is there something in the TW handles dates?


This is a TWCore issue.  It's mostly (but not entirely) a timezone thing related to the difference between "localtime" and "UTC" (Universal Time Coordinated)

Try entering this at http://TiddlyWiki.com:
<$text text={{!!birth-date}}/><br>
LOCAL TIME:
<$view field="birth-date" format="date" template="MMM DDth YYYY 0hh:0mm:0ss" />
<br>
UTC:
<$view field="birth-date" format="date" template="[UTC]MMM DDth YYYY 0hh:0mm:0ss" />

where the "birth-date" field contains "20201020".

For example, I am in California, which is currently timezone UTC-7 (i.e., 7 hours behind UTC).

The LOCAL TIME result will be: "October 19th 2020 17:00:00"
but the UTC result will be: "October 20th 2020 00:00:00"

HOWEVER, there *is* something odd going on for any date earlier than 18831119...

Set birth-date to "18831119"...
The LOCAL TIME result will be "November 18th 1883 16:00:00"
but the UTC result will be "November 19th 1883 00:00:00"

Still correct.  BUT.. 

Set birth-date to "18831118"...
The LOCAL TIME result will  "November 17th 1883 16:07:02"
but the UTC result will be "November 17th 1883 23:59:02"

There's some kind of weirdness happening with the time portion of the formatting!

Note that this is happening on http://TiddlyWiki.com, so it is a TWCore issue unrelated to any TiddlyTools/Time code.

I think we need to get Jeremy involved to figure this out.

-e

TW Tones

unread,
Oct 20, 2020, 6:47:47 PM10/20/20
to TiddlyWiki
Eric,

For older dates I have being setting them to 12pm "Noon" eg YYYMMDD1200... such that even if UTC is or is not applied the ±12 hours does not change the date according to the time of day. (There may be a daylight savings time ±13 occur)
  • So in many cases I have a date field independent of date\time that I just never display with a timezone.

This seemed an acceptable and logical work around to me, picking the time in the middle of a date if I do not care about time of day.

Hidden in a serial number date if it has say seconds and milliseconds all zero's, I take this to mean a set date/time, rather than an "organically" captured date. One could test for this and not apply a time offset to such dates.

Regards
Tony

Eric Shulman

unread,
Oct 21, 2020, 2:50:38 AM10/21/20
to tiddl...@googlegroups.com
On Tuesday, October 20, 2020 at 10:56:13 AM UTC-7, Eric Shulman wrote:
Set birth-date to "18831119"...
The LOCAL TIME result will be "November 18th 1883 16:00:00"
but the UTC result will be "November 19th 1883 00:00:00"

Set birth-date to "18831118"...
The LOCAL TIME result will  "November 17th 1883 16:07:02"
but the UTC result will be "November 17th 1883 23:59:02"

There's some kind of weirdness happening with the time portion of the formatting!

Well... I did a little research and here's what I've found out:

1) Using the Chrome developer console:
* I entered $tw.utils.parseDate("18831119")
* The result was "Sun Nov 18 1883 16:00:00 GMT-0800 (Pacific Standard Time)"
* I entered $tw.utils.parseDate("18831118")
* The result was "Sat Nov 17 1883 16:07:02 GMT-0752 (Pacific Standard Time)"

So... it appears the source of the odd time value is $tw.utils.parseDate(), which is defined as:
$tw.utils.parseDate = function(value) {
 
if(typeof value === "string") {
 return new Date(Date.UTC(parseInt(value.substr(0,4),10),
 parseInt
(value.substr(4,2),10)-1,
 parseInt
(value.substr(6,2),10),
 parseInt
(value.substr(8,2)||"00",10),
 parseInt
(value.substr(10,2)||"00",10),
 parseInt
(value.substr(12,2)||"00",10),
 parseInt
(value.substr(14,3)||"000",10)));
 
} else if($tw.utils.isDate(value)) {
 
return value;
 
} else {
 
return null;
 
}
};

But that code just uses Date.UTC(...), which is JavaScript "native code", so its internal workings are not determined by TiddlyWiki at all.

2) So, I started to wonder, "Is there something special about November 18, 1883?"... and this is what I found:


Which says:
On November 18, 1883, America’s railroads began using a standard time system involving four time zones, Eastern, Central, Mountain and Pacific. Within each zone, all clocks were synchronized. The railroad industry’s plan was adopted by much of the country, although the time-zone system didn’t become official across the United States until the passage of the 1918 Standard Time Act

So, it appears that the strange time output is related to the original creation of standardized time zones!

The only work-around for this oddness is to use the trick that I suggested some time ago, which Tony referenced in his reply.

For accurate dates, regardless of local timezone, add "12" to the end of the date; e.g. "1883111812", which specifies a *time* of "12 noon".
Because timezones range from UTC-1200 to UTC+1200, the resulting computed date will be correct by avoiding the effect of the
localtime timezone offset that shifts the time back (or forward) by up to 12 hours.

-e

Eric Shulman

unread,
Oct 21, 2020, 3:18:41 AM10/21/20
to TiddlyWiki
On Tuesday, October 20, 2020 at 11:50:38 PM UTC-7, Eric Shulman wrote:
For accurate dates, regardless of local timezone, add "12" to the end of the date; e.g. "1883111812", which specifies a *time* of "12 noon".
Because timezones range from UTC-1200 to UTC+1200, the resulting computed date will be correct by avoiding the effect of the
localtime timezone offset that shifts the time back (or forward) by up to 12 hours.


The Calendar code for getevents_timeline() and getevents_timeline_annual() have been adjusted to handle dates that have more than 8 digits
(they now ignore any excess digits).  This allows the "timezone hack" described above to be used without impacting the automatic generation
of events for "annual" and "range" timelines.

-e


Anthony

unread,
Oct 21, 2020, 4:19:36 AM10/21/20
to TiddlyWiki
Thanks Eric for all the investigations, that's interesting.

I'm in the UK and, it seems for me, that the 'break point' for the date is 2 December 1847. Back to then everything seems to be fine but go to 1 December 1847 and the date displayed is a day earlier, so 30 November 1847 in this case. I don't see a problem at 18 November 1883 when standardized time zones introduced in the USA. I'm not sure what this means!

I'll update my project with the new timer tiddlers shortly.

Take care,

Anthony

Eric Shulman

unread,
Oct 21, 2020, 5:07:42 AM10/21/20
to TiddlyWiki
On Wednesday, October 21, 2020 at 1:19:36 AM UTC-7, Anthony wrote:
I'm in the UK and, it seems for me, that the 'break point' for the date is 2 December 1847. Back to then everything seems to be fine but go to 1 December 1847 and the date displayed is a day earlier, so 30 November 1847 in this case. I don't see a problem at 18 November 1883 when standardized time zones introduced in the USA. I'm not sure what this means!

Does the "timezone hack" (appending "12" to the end of the date... i.e., "1847120112") bypass the problem?

-e


Eric Shulman

unread,
Oct 21, 2020, 8:25:12 AM10/21/20
to tiddl...@googlegroups.com
On Tuesday, October 20, 2020 at 9:11:00 AM UTC-7, Eric Shulman wrote:
On Tuesday, October 20, 2020 at 8:18:03 AM UTC-7, Anthony wrote:
However, I've noticed something else that happened originally, then was 'fixed' but is happening again. When I click on a day in the calendar display where there's an event, say a birth, that's included in an events tagged tiddler called 'Born on this Day' then the link goes to a tiddler called 'Born on this Day: Frances Hamilton Arnold (1956-)' (say), which does not exist. Rather I'd hope it went to a tiddler called 'Frances Hamilton Arnold (1956-)' that does exist and has all the data that generates all the events etc. for that individual. This is what happened before the latest two-line change to getevents_listed().

As you've noted, an event is linked to a tiddler using "EventList: description text" as the title.  This is so that if the same description is used in separate EventLists, they don't link to the same tiddler.

Upon re-examination of the way events are being linked, I realized that links from getevents_linked() were actually inconsistent with the way links from getevents_ics() and getevents_timeline() are being handled.

In the latter two cases, the link is to the event_text, without including the event_source in the title.

So... despite the reasons given in my previous explanation, I have reverted the code in getevents_linked() to its old behavior so that
*any* type of event (listed, ics, or timeline) now consistently links to the event_text, without adding the event_source as a prefix.

This means that, in the example I gave, "Bob's Events: My Birthday" and "Jim's Events: My Birthday" will, by default, link to the same "My Birthday" title.

To override this default handling, you can provide explicit alternative titles using the added "|TiddlerTitle" syntax.

In "Bob's Events", you would write:
....MMDD;My Birthday|Bob's Birthday
which will be shown as "Bob's Events: My Birthday" and link to "Bob's Birthday"

In "Jim's Events", you would write:
....MMDD;My Birthday|Jim's Birthday
which will be shown as "Jim's Events: My Birthday" and link to "Jim's Birthday"

In your "Born on this Day" EventList, you can now omit the extra "|TiddlerTitle" syntax and just use:
....MMDD;Frances Hamilton Arnold (1956-)

and for a generated EventList, you could write:
<$list filter="[has[birth-date]]">
   <$view field="birth-date" format="date" template="....0MM0DD" />;<
<currentTiddler>><br>
</$list>

Sorry for the "shifting sands", but this updated logic is now
A) more consistent
B) requires less data for the default case

-e

TW Tones

unread,
Oct 21, 2020, 8:51:41 AM10/21/20
to TiddlyWiki
Eric,

Thanks for sharing this historical information. 

I remember a Quote from a writer, that complained of modern technology dividing the day into smaller and smaller fragments of time, it was a roman complaining about the sundial. :)

I knew about the railroads, and the telegraph causing the invention of time zones but never though it would be yet another complication (today). The Art of dates and calendars is far more complex than most people know.

2) So, I started to wonder, "Is there something special about November 18, 1883?"... and this is what I found:


Which says:
On November 18, 1883, America’s railroads began using a standard time system involving four time zones, Eastern, Central, Mountain and Pacific. Within each zone, all clocks were synchronized. The railroad industry’s plan was adopted by much of the country, although the time-zone system didn’t become official across the United States until the passage of the 1918 Standard Time Act

So, it appears that the strange time output is related to the original creation of standardized time zones!

Would you have started this wonderful set of tools had you known beforehand?
 
By the way in this thread I discuss my interest in Analytics, your calendar solution goes some way to supporting this approach "bringing created and modified dates, amongst others to be more readily seen in a calendar", as does Bimlas's suggested answer.

Regards
Tony

Anthony

unread,
Oct 22, 2020, 6:11:26 AM10/22/20
to TiddlyWiki
Hi Eric,

Yes, this works fine so far as I can see... I attempted to reply yesterday but, it seems, something went astray and my message wasn't posted. I'll update and try out the reversion to getevents_linked() that you discuss in your next message.

Thanks again for everything,

Anthony

Eric Shulman

unread,
Oct 23, 2020, 12:02:31 AM10/23/20
to tiddl...@googlegroups.com
update Oct 22, 8:30pm:

"custom event colors" can now be configured via the Calendar Settings panel,
which displays "color swatches" for each individual EventList, Timeline, and .ics tiddler,
as well as the "Events and Timelines" default event color and the "Tiddler Changes" color.

Just click on a color swatch to show a popup color input field/list.  You can then type in any
valid CSS color value -- e.g., "#cfc", "#aabbcc", "rgb(0,0,255)", "rgba(0,0,255,0.5)" or select
from any of 127 different X11 color names.  Click the checkmark (or press enter) to apply
the new color value.  Click "X" (or press escape) to cancel the change.

Also, there is a "menu" button next to each individual EventList, Timeline, and .ics tiddler.
Click to show additional buttons to "edit", "copy" or "delete" the corresponding tiddler.

"edit" will open the tiddler in the Story River, using the standard TiddlyWiki tiddler editor.
"copy" will duplicate the existing entry, adding a number to the end of the tiddler title and caption text
"delete" will ask for confirmation before deleting the tiddler

Note that when you copy an .ics entry, the copy is automatically converted into an
EventList tiddler making it easy to edit the list of events without needing to work
with the complex iCalendar data format.

Similarly, when you copy a Timeline entry, the copy is automatically converted into an
EventList tiddler by creating entries for each of the associated individual Timeline Event
tiddlers into a single, easily edited text list of events.

enjoy,
-e

Anthony

unread,
Oct 24, 2020, 4:39:54 AM10/24/20
to TiddlyWiki
Thanks Eric, I'd noticed this and already started to use the additional useful functionality.

Take care,

Anthony
Reply all
Reply to author
Forward
0 new messages