@Mohammad can you please guide?
Hi @arunnbabu81
I missed this post!
In prevous solution
filter="[prefix[Job]tag[task]search{$:/temp/demo/dtable/search}] :filter[get[due-date]match<now "YYYY-0MM-0DD">]"
This part does the trick
:filter[get[due-date]match<now "YYYY-0MM-0DD">
This time you want to compare the due-date
with journal-date
so, I think you need
this
:filter[get[due-date]match{!!journal-date}]
This is not tested and assume the format of date for both field is the same!
If you could provide a minimum example, then I can be more helfulp.
I am not able to get it right. Will show a demo wiki when i am back on my laptop
Yes, please provide a minimum example with exactly what you want.
same outcome but shorter and theoretically faster:
:filter[due-date{!!journal-date}]
I have a reading list tiddler in my wiki based on shiraz dynamic table.
I use tiddlyclip to send webpages (iframe embedded within the tiddlers) to the Reading List tiddler by tagging them with “Readinglist”
i use the code given blow for the dynamic table in the Reading List tiddler to get all tiddlers with the tag “Readinglist”
Filter and search in table <$edit-text tiddler="$:/temp/demo/dtable/search" filed=text tag=input default=""/> <$button set="$:/temp/demo/dtable/search" setTo="" tooltip="clear searchbox">x</$button>
<$macrocall $name=table-dynamic filter="[tag[Readinglist]search{$:/temp/demo/dtable/search}]" class="w-100 thead-dark table-center" fields="tbl-checkbox tbl-expand title priority status due-date location" pagination="yes" caption="''title''">>
I also have daily Journal tiddlers. These Journal tiddlers have field called journal-date
.
journal-date
is a field which is automatically added to all journal tiddlers i create from Eric’s Calendar with the help of TiddlyTools/Time/JournalListChanges. Refer to these discussion - 1 and 2
This how it looks
I want to list in the Journal tiddler, only those reading list tiddlers
which have due-date
same as that of the Journal date.
I tried this code given by @Mohammad which filter tiddlers whose due-date
match today
!Reading list
Filter and search in table <$edit-text tiddler="$:/temp/demo/dtable/search" filed=text tag=input default=""/> <$button set="$:/temp/demo/dtable/search" setTo="" tooltip="clear searchbox">x</$button>
<$macrocall $name=table-dynamic filter="""[tag[Readinglist]search{$:/temp/demo/dtable/search}] :filter[get[due-date]match<now "YYYY-0MM-0DD">]""" class="w-100 thead-dark float-right" fields="tbl-checkbox tbl-expand title priority status due-date location" pagination="yes" caption="''title''">>
This one was working. But i had another problem with this one - if i want to check the previous day journal for seeing the pending reading list tiddlers, it wont be seen.
Then i thought its better to match the due-date
with the date in the journal-field
of the Journal tiddler.
I tried these code given by Mohammed and Saq for using the journal-date
instead of now
, but its not working on my side.
<$macrocall $name=table-dynamic filter="""[tag[Readinglist]search{$:/temp/demo/dtable/search}]:filter[get[due-date]match{!!journal-date}]""" class="w-100 thead-dark" fields="tbl-checkbox tbl-expand title priority status due-date location" pagination="yes" caption="''title''">>
<$macrocall $name=table-dynamic filter="""[tag[Readinglist]search{$:/temp/demo/dtable/search}] :filter[due-date{!!journal-date}]""" class="w-100 thead-dark" fields="tbl-checkbox tbl-expand title priority status due-date location" pagination="yes" caption="''title''">>
This is what i see in today Journal tiddler.
But i have two reading list tiddlers with todays due-date
I guess i am making some mistake in the code.
Would you please share the value of due-date? I want to know how the date looks like in your due-date field.
Journal-date as I see from the image is a full date (TW format)
This is not correct! journal-date
is not a macro! I am not sure if TiddlyTools has such a macro, if it has, then this may be correct!
Sorry that was not the code given by you. I accidentally changed it while I was checking what was going wrong.
I have edited it
Try this solution
!Reading list
Filter and search in table <$edit-text tiddler="$:/temp/demo/dtable/search" filed=text tag=input default=""/> <$button set="$:/temp/demo/dtable/search" setTo="" tooltip="clear searchbox">x</$button>
<$vars journaldate={{{ [{!!journal-date}format:date[YYYY-0MM-0DD]] }}} >
<$macrocall $name=table-dynamic filter="""[tag[Readinglist]search{$:/temp/demo/dtable/search}] :filter[due-date<journaldate>]""" class="w-100 thead-dark float-right" fields="tbl-checkbox tbl-expand title priority status due-date location" pagination="yes" caption="''title''">>
</$vars>
This code shall be used in any journal tiddler which has a field journal-date with a full date value as shown in the image above.
I am sure you use a viewtemplate!
The trick is here: :filter[due-date<journaldate>]
Note that: `This code shall be used in any journal tiddler which has a field journal-date with a full date value as shown in the image above.
I am sure you use a viewtemplate!
Note that <$vars journaldate={{{ [{!!journal-date}format:date[YYYY-0MM-0DD]] }}} >
reads the value of journal-date field and format it in such a way you can compare with due date from Shiraz dynamic table.
Will get back once i am home.
This is the one I wanted. Thank you
@Mohammad I have encountered one issue.
See the images below
This is my readinglist made using dynamic table.
There are two items with due date 20220216 and one item with due date 20220218.
Now i am using this code to extract the readinglist tiddlers with due-date same as that of that days Journal tiddler to be displayed in the same Journal tiddler using a viewtemplate.
But see what is happening.
Tiddler with due-date 20220218 is shown in the Journal tiddler of 17th February 2022.
Tiddler with due-date 20220216 is shown on the Journal tiddler of 15th February 2022.
How to correct this ?
As there is one day difference I suspect to the date-time is used here. I think Tiddlywiki uses UTC time for internal time-date and we set the due date manually!
I am sure @EricShulman had an informative post and gave some solutions there!
I will come back and look at your code! but the I guess the symptom is the time-date values.
You are formatting the journal-date
value using YYYY-0MM-0DD
so that it can be compared with a due-date
field value, using this code:
<$vars journaldate={{{ [{!!journal-date}format:date[YYYY-0MM-0DD]] }}} >
The format:date[...]
filter operator assumes that the {!!journal-date}
input value is stored as a UTC datetime value and, because the specified conversion format (YYYY-0MM-0DD
) is a local datetime format, the resulting formatted datetime is being automatically adjusted in order to produce a local datetime value.
However, the journal-date
value is actually already stored as a local datetime value. As a result, it is possible that – depending upon your timezone offset and the specific time of the input date – the format:date[]
filter is incorrectly shifting the input datetime to the previous day when the operator is being applied.
To prevent this shift in time from happening, try using an explicit UTC format (i.e., [UTC]YYYY-0MM-0DD
) as the operand for the format:date[]
filter.
Unfortunately, there is a little bit of a syntax problem here: you can’t nest the required [UTC]
square brackets directly in the operand of the format:date[]
filter syntax. The usual workaround technique to address this is to first set a variable containing the [UTC]YYYY-0MM-0DD
datetime syntax, and then reference that variable in the filter, like this:
<$vars fmt="[UTC]YYYY-0MM-0DD">
<$vars journaldate={{{ [{!!journal-date}format:date<fmt>] }}} >
Because format:date[]
assumes the input is already UTC, and you are telling it to use a [UTC]
output format, it will convert the input without applying any time shift. That should preserve the correct date value.
Give that a try and let me know how it goes…
-e
I think its working. I will give feedback after using it for a few more days. Thank you.
@Mohammad @EricShulman
Till recently I was succesfully using the code given below to retrieve all tiddlers with due-date
field which corresponds to the date of the journal tiddler’s date.
Filter and search in table <$edit-text tiddler="$:/temp/demo/dtable/search" filed=text tag=input default=""/> <$button set="$:/temp/demo/dtable/search" setTo="" tooltip="clear searchbox">x</$button>
<$vars fmt="[UTC]YYYY-0MM-0DD">
<$vars journaldate={{{ [{!!journal-date}format:date<fmt>] }}} >
<$macrocall $name=table-dynamic filter="""[tag[Readinglist]search{$:/temp/demo/dtable/search}] :filter[due-date<journaldate>]""" class="w-100 thead-dark float-right" fields="tbl-checkbox tbl-expand title priority status due-date location" pagination="yes" caption="''title''">>
</$vars>
As discussed here I started using pikaday date-picker to add a due
field instead of the previous due-date
field to these tiddlers.
Previously the due-date
field used a date format like this
Now the due
field uses a format like this
So now the above code is not working. What modification should I do to make it work again?
I have made a demo here
Click on the Readinglist
link in the topbar to see the relevant tiddlers.
Try changing
<$vars fmt="[UTC]YYYY-0MM-0DD">
to
<$vars fmt="[UTC]YYYY0MM0DD120000000">
-e
Thank you @EricShulman
That did the trick. Is there any documentation about usage UTC time in tiddlywiki.