Hi,

I authored the days filter operator. Haven’t been here for a while, and 
came back to find several threads all revolving around more or less the 
same thing - an inability to produce a range of days that ends yesterday 
(past days) or starts tomorrow (days in the future). I submitted a patch 
#2364 <https://github.com/Jermolene/TiddlyWiki5/pull/2364> to address the 
issue. Following is a description of the days filter operator, most of it 
is applicable now, but cases involving a start day of tomorrow or an end 
day of yesterday will only be possible after the patch.
Parameter 

The parameter (let’s call it D) is a number of days from today. It marks a 
begining or an end of a time interval. 0 is today only. 1 is tomorrow and 
everything before, -1 is yesterday and everything after, etc.
Suffix 

3 days in the future may not make sense for a field like “modified”. That’s 
where the suffix comes in handy.
Say you have a field “due” in your tiddlers. days:due[3] will return 
tiddlers that are due within 3 days from today, and all past due.
Negation (logical NOT) 

This is where the patch will change the behavior a bit.

If days:due[3] is everything that is due within the next 3 days, then, 
strictly speaking, !days:due[3] should mean anything that is NOT due due 
within the next 3 days, or , in other words, anything that is due in 4 days 
or more. That’s how the operator works now, and that makes it impossible to 
specify a period starting tomorrow or ending yesterday, since !days:due[1] 
means “due in 2 days or more”, and !days:due[-1] means “was due 2 days ago 
or before”.

After the patch, !days:due[1] will mean anything that is due in *1* days or 
more, !days:due[-1] will mean anything that was due yesterday or before.
Specifying a range of days (finite number of days) 

Everything we’ve looked at so far was open-ended intervals. To get a closed 
interval, you simply combine two days operator steps in a filter run 
<http://tiddlywiki.com/#Filter%20Run>, and sometimes add a third one in a 
filter 
expression <http://tiddlywiki.com/#Filter%20Expression>
Examples (after the patch) 

today:
<<list-links '[days:due[]]'>>
4 days ago:
<<list-links '[days:due[-4]!days:due[-4]]'>>
<<list-links '[days:due[-4]] -[days:due[-3]]'>>
last 5 days:
<<list-links '[days:due[-5]!days:due[-1]sort[due]]'>>
next 5 days:
<<list-links '[!days:due[1]days:due[5]sort[due]]'>>
day before yesterday:
<<list-links '[days:due[-2]] -[days:due[-1]]'>>
yesterday:
<<list-links '[days:due[-1]] -[days:due[]] -[!days:due[1]]'>>
<<list-links '[days:due[-1]!days:due[-1]]'>>
tomorrow:
<<list-links '[!days:due[1]days:due[1]]'>>
<<list-links '[!days:due[1]] -[!days:due[2]]'>>
day after tomorrow:
<<list-links '[!days:due[2]] -[!days:due[3]]'>>

On Saturday, March 12, 2016 at 7:54:25 AM UTC-8, Julian Kniephoff wrote:

Sorry for the late reply, I was trying to figure out the best way to share 
> this, but I didn't have that much time on my hands, so I'm just going to 
> attach the js files; you should still be able to just drag and drop them 
> into your TiddlyWiki.
>
> To answer your questions:
>
>    - The two filters take the field they are operating on as their 
>    operand. So to get everything that is scheduled today or in the past, you 
>    would write [past[scheduled]].
>    - The filters don't take any other arguments, i.e. they also don't use 
>    the suffix. They *do* however work with the usual ! prefix: 
>    [!past[scheduled]] should give you everything that is scheduled in the 
>    future, explicitly excluding today.
>    - Unfortunately at this point there is no documentation other than 
>    this post.
>
> Note that these filters only handle the cases that can't be done with days, 
> hence the lack of further flexibility (taking integer arguments and the 
> like). Specifically these are: Get everything with a given date field set 
> in the past/future including/excluding today. You will still have to use 
> days to achieve any other configuration.
>
>
> On Tuesday, March 8, 2016 at 11:20:06 AM UTC+1, CL wrote:
>>
>> Thank you for sharing your TW-dating code!
>> I am end-user who does not really know how to code. My hotfix was best I 
>> could do :)
>> Those new filters look promsing. However I coudn't figure out how to use 
>> your filter. I want to ask,
>>
>>    - Does this filter take suffix for name of date field like days 
>>    operator <http://tiddlywiki.com/static/days%2520Operator.html>?
>>    - Does this filter take integer as parameter?
>>    - Is there any other documentation for instruction?
>>    
>> I would be super nice if you could make that into tiddler and attach as 
>> .tid file or
>> you could put it in wiki file and attach wiki file here so people can 
>> simply drag and drop the tiddlers
>>
>> ​

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0d899550-4187-42bb-ac9f-61d13f48c944%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to