Måns, First of all: no, we do not define the results of getDay(). Those are given by said standard javascript function.
I believe both your intellectual and your js capacity do just fine, I can tell. It's just my sloppy untested proposals which at times need a second look to turn out right... So, if getDay() = 0 means we're talking of a Sunday ....and with 1 being Monday ...and a week presumably having some unchanging 7 days ...well then to get weekends, the code must sure read like this: <<tiddler {{ [0,6].contains((new Date()).getDay())?"WeekendTiddler":"WeekDayTiddler" }}>> My morning sleepiness almost went so far as to write saturday as being 7, but lucky for us, I spared us that bit of confusion, phew. I guess that's why quality code, above all, requires just as much attention (1) as it does require know-how ...or rather 'know where to look for answers for problems to solve' ...and most importantly, testing (2). In other words, it can be that simple and you can still get wrong, if you miss out on those two. :-D Cheers, tb On 14 Jan., 08:28, Måns <humam...@gmail.com> wrote: > Hi Tobias > > > Would this help to get to the right evaluated > > statement?http://www.w3schools.com/jsref/jsref_getday.asp > > Yes I think/hope so - thank you very much :-) > > > > > > > > > > > Something like: > > <<tiddler OnlyOnSundays if:{{(new Date()).getDay()==0;}}>> > > > In case you have multiple valid weekdays, e.g. "weekends", you could > > check for... > > <<tiddler OnlyForWeekends if:{{ > > [0,1].contains((new Date()).getDay()); > > > }}>> > > > You could do a similar check for months for something like... > > "Welcome back to our new years special" > > > But, if you really need the two alternatives, you might as well do > > this, without requiring CoreTweak 890 at all... > > > <<tiddler {{ > > [0,1].contains((new > > Date()).getDay())?"WeekendTiddler":"WeekDayTiddler" > > > }}>> > > > Come to think of it, it much looks like one really never needs > > CoreTweak 890. Since <<tiddler "">> doesn't render anything, you can > > apply the above trick under any condition. So, your basic conditional > > tiddler makro simply looks like this: > > > <<tiddler {{condition?"IfTrueShowThis":""}}>> > > > Whereas condition corresponds to a syntactically correct boolean > > expression. > > Your thoughts on this matter are very *very* welcome, - my > intellectual capacity (and js-experience) is however not quite there > yet I'm afraid .... > > Kriss had a question in > november:http://groups.google.com/group/tiddlywiki/browse_thread/thread/121884... > which seems to be similar (in some respect ??..)... > > Would you be so kind to write an example where "condition" is a > boolean expression which asks if Today is Thursday > "IfTrueShowThis":"TiddlerYesThisIsThursday" ??? > > Q: > If I write this: "<<tiddler {{ > [0,1].contains((new > Date()).getDay())?"WeekendTiddler":"WeekDayTiddler"}}>> " > > It will show the content of WeekDayTiddler if date is 0 or 1 ?? - > Is 0 and 1 always Sunday and Monday - or must I define those > "somewhere" in the script - like: > var d=new Date(); > var weekday=new Array(7); > weekday[0]="Sunday"; > weekday[1]="Monday";) > > Or is it WeekendTiddler which defines what days that are weekenddays?? > > Hmm - > As you can tell - from my questions - I'm a "little" out of my league > here :-) > > Cheers Måns Mårtensson -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to tiddlywiki@googlegroups.com. To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.