wow. now that I am using just a single field to store date, I find out that 
I can easily use MatchTagsPlugin to produce a list in chronological order:
<<matchTags inline "[[%0]]" "\n" sort:event_when event>>

On Monday, December 10, 2012 8:38:19 PM UTC+5:30, passingby wrote:
>
> After a lot of tinkering and experimenting with javascript snippets found 
> online I have finally decided that the simplest way is the best way. 
> I decided to do away with event_year, event_month, event_date fields. 
> Instead just kept a field event_when. And in the associated textbox I take 
> care to enter the value as yyyy,mm,dd so that this string when retrieved 
> can be directly used to create a javascript Date object using new 
> Date(DateString) syntax.
>
> So I have put this code in a tiddler and tagged it with systemConfig:
>
> var sortNestedFieldDate = function (arr) {
>     arr.sort(function (a, b) {
>         var valueA = new Date(a.fields.event_when);
>         var valueB = new Date(b.fields.event_when);
>
>         if (valueA < valueB) {
>             return -1;
>         } else if (valueA > valueB) {
>             return 1;
>         } else {
>             return 0;
>         }
>     });
> };
>
> And then in a separate tiddler I call this code as inline script (within 
> script tags):
>
> <script>
> var events= store.getTaggedTiddlers("Event");
> sortNestedFieldDate(events);
> events.sort();
> var out=[];
> for  (var i=0;i<events.length;i++){
>  out.push(events[i].fields.event_when.toString()+":   
> [["+events[i].title+"]]");
> }
>
> return out.join("\n");
> </script>
>
> This prints out a list of tiddler sorted on date (field event_when) of the 
> event. Hope this helps some future TW user.
> As a side note I was a little bit disappointed that there is no DatePicker 
> plugin available in TW world. There is one interwined in mGSD TW but for me 
> it is near impossible to create a decent workable independent code out of 
> it. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/tiddlywiki/-/6nHq7WCUDyMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to