How to filter by due date of today in shiraz dynamic table

Will get back once i am home.

This is the one I wanted. Thank you :+1:

@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.

1 Like

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

2 Likes

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

image

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

2 Likes

Thank you @EricShulman

That did the trick. Is there any documentation about usage UTC time in tiddlywiki.