I want to sort tiddlers after a custom date field and format results in a 
table so I tried

<<tiddler ListaTB14Email##out with: {{
    var now = new Date();
    var thismonth = now.getMonth();
    var out=["!!!Email TB14\n|sortable|k\n|Datum|Mail|h"];
    var fdatum = "fdatum";
    var tids=store.getTaggedTiddlers("kundkort");
    for (var i=0; i<tids.length; i++) {
        var t=tids[i].title;
        var bearbetningsdatum = new Date(store.getValue(t,"fdatum"));
        var year = bearbetningsdatum.getFullYear();
        if ( year < 10 ) year = '0' + year;
        var month = bearbetningsdatum.getMonth()+1;
        if ( month < 10 ) month = '0' + month;
        var day = bearbetningsdatum.getDate();
        if ( day < 10 ) day = '0' + day;
        var date = year + '-' + month + '-' + day;
        if (month == thismonth || month == thismonth + 1 || month == 
thismonth + 2) {
            var email=store.getValue(t,"email");
            var email2=store.getValue(t,"email2");
            out.push("|%0|%1,%2|".format([date,email,email2]));
        }

    }
    out.join("\n");
}}>>

But sorting the results is missing. So I wonder how to do that? Also if 
this is overly complicated way of getting the result I'm happy to hear 
suggestions on how to simplify it.

Daniel

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to