Folks,

For the intellectually or wiki text, curious, I stumbled upon the following 
as a result of someone else's code

I have not yet published many wikis and plugins because I am still 
exploring all the fundamental methods without resorting to javascript. This 
is and example of how I overcame a serious limitation by discovering 
something which is perhaps an undocumented feature. If there is a gap, I am 
trying to fill it.

However I give you notice I hope to publish a large number of macros, tools 
and plugins in the near future, especially to support designers and rapid 
development.

Try this on tiddlywiki.com in a tiddler
<$list filter="[range[10,100,10]]">
{{!!title}}
</$list>
This seems intuitive correct but if you think about it the `{{!!title}}` 
field, does not exist for the virtual tiddlers that result from this range 
widget.

*Why would I care?*

   - In tiddlywiki the only inbuilt way to translate a date serial number 
   into a date is the view widget
      - eg `<$view tiddler="" $field="" format="date" 
      template="YYYY-0MM-0DD"/>`
      - or  `<$view tiddler="" $field="" format="relativedate"/>`
   - Created and modified dates as fields are an exception to this rule try 
   {{!!created}} to see what I mean.
   - *The view widget does not permit variables as inpu*t, which has being 
   a long time annoyance to me
   - *I now have an avenue to bypass this limitation*, also observed in use 
   in some of JED's code

For example provide a literal date as a variable via the list, but use the 
title as a field
<$list filter="[[20210506]]">
<$view field=title format="date" template="YYYY-0MM-0DD"/>
</$list>

   - Not sure If I can get the relative date even with a full date serial 
   (yet)

Another exciting development, try this
<$list filter="[range[20210215,20210315,1]]">
<$view field=title format="date" template="YYYY-0MM-0DD"/><br>
</$list>
I am incrementing the date 2021/02/15 one day at a time until 2021/03/15

   - Notice the list* only returns valid dates*
   - Now you can get a list of *valid *dates 

Recognises year change
<$list filter="[range[20201225,20210105,1]]">
<$view field=title format="date" template="YYYY-0MM-0DD"/><br>
</$list>

Use to convert formats
<$list filter="[[2020-12-25]split[-]join[]]"><!-- or variable,field etc -->
<$view field=title format="date" template="0DD/0MM/YYYY"/><br>
</$list>
Whilst I could use join[/] I would not reorder the values, as in this case

Other interesting and working examples
<$list filter="[range[20201201,20211201,100]]">
<$view field=title format="date" template="DDD YYYY-0MM-0DD"/><br>
</$list>
What is the day of week of the first of every month?

Adding 7 days creeps forward? Not quite right?
<$list filter="[range[20201225,20210105,7]]">
<$view field=title format="date" template="0WW DDD YYYY-0MM-0DD"/><br>
</$list>
What is happening here, whats wrong with the order, is there a work around.

*Conclusions*

   - Setting currentTiddler in a list via a filter allows you to use any 
   filter to set a value, including a variable and *use title as the input 
   to the ViewWidget*.
   - This opens the view widget up to any date even if it is a variable (or 
   any other widget with this limitation?)
   - given it only returns valid dates, it is a source of a series of valid 
   dates taking into account the changes inherit in calendars
   - It can be used to reformat any valid date even as a variable, or 
   generated with increments.
   - A set of easy to use wikitext macros can be written to count, 
   generate, manipulate dates, without any plugin or JavaScript code.

*Optional challenge(s) *(for the reader)

   - It could be used to generate a method of counting days between two 
   dates (left for the curious) 
      - Tip count the output?
   - Used to generate date tiddlers of any format.

Regards
TW Tones

-- 
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/2a26609f-b5e9-4a50-99a7-feaf6d480df4o%40googlegroups.com.

Reply via email to