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(), 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

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6bb93f7d-f3e2-49c0-a895-ab3ec142b97do%40googlegroups.com.

Reply via email to