[TW5]Question about days operator

314 views
Skip to first unread message

CL

unread,
Jan 30, 2016, 2:09:02 AM1/30/16
to TiddlyWiki
First of all, I could not attach any minimal test case
because this question is about days operator which can vary depends on your local time.

I am trying to get list of tiddlers due within 7 days including today and excluding past event.
I thought excluding past event would be not that complicated but it's trickier than I thought.
I just couldn't figure out this.

<<list-links '[days:due[7]days:due[-1]]'>>

This macro retrieve task due in 7 days but includes task due yesterday.

<<list-links '[!days:due[1]days:due[7]][days:due[0]]'>>

This macro retrieve task due in 7 days and except task due tomorrow.

I have tried various days operator form but I coudn't figure out how to deal with this +-1 day problem.
Any help would be really appriciated

Best wishes

CL


Tobias Beer

unread,
Jan 30, 2016, 2:14:49 PM1/30/16
to TiddlyWiki
Hi CL,

For one, I think the documentation of the days filter — especially the output — is highly confusing, almost non-understandable. I'd also think the current examples are not sufficient. In fact, some issues may need "dynamically created test tiddlers" to demonstrate how they work.

This macro retrieve task due in 7 days but includes task due yesterday.

<<list-links '[!days:due[1]days:due[7]][days:due[0]]'>> 

So, if I understand you right, you wish to get a list of all that are due within {-1,+7}, correct?

Best wishes,

Tobias.

CL

unread,
Mar 7, 2016, 12:07:10 PM3/7/16
to tiddl...@googlegroups.com
I am sorry for the late reply. I was travelling for my holiday.
First of all, result of days operator would change depends on time.
I couldn't think of any good example at that time.
So, let me try to explain the situation again and ask few other things.

Let's assume,
  • Today is 8th of March
  • Task A is due 6th of March
  • Task B is due 7th of March
  • Task C is due 8th of March
  • Task D is due 9th of March
  • Task E is due 10th of March

The list I want to get is,

  • Task C
  • Task D
  • Task E
Main problem is Task B and D.
I don't think there is obvious way to include Task D and exclude Task B
My first question is 'Is there any easy way of getting the list above?'.

I just couldn't figure it out, so I did some workaround.
Even though I do not have knowlege of javascript or coding but I modified days operator javascript tiddler.
I changed,
  • targetTimeStamp = (new Date()).setHours(0,0,0,0) + 1000*60*60*24*dayInterval, <- this line to,
  • targetTimeStamp = (new Date()).setHours(0,0,0,0) + 1000*60*60*24*dayInterval + 1000*60*60*24*1, <- to this
I don't really know what's going on in that javascript but I thought this would add one day to the timeline of days operator.
Now,

 <<list-links '[days:due[-1]]'>>

Result of original days operator,
  • Task B
  • Task C
  • Task D
  • Task E
Result of modified days operator,
  • Task C
  • Task D
  • Task E

This is how I got my result at the moment.

Now, I want to clone this javascript tiddler and make it into new operator with new name. Because I need original days operator as well.

I tried to clone tiddler and change title of it didnt work. How can I do this?





leoperbo

unread,
Nov 5, 2016, 9:37:50 PM11/5/16
to tiddl...@googlegroups.com
Try this:

<$set name="daysfromtoday1" value="-1">
<$set name="daysfromtoday2" value="7">

<$list filter="[days:due
<daysfromtoday1>days:due<daysfromtoday2>sort[due]]">

<ul><li><$link to={{!!title}}><$view field="title"/> </$link></li></ul></$list>
</set>
</set>
Reply all
Reply to author
Forward
0 new messages