Pikaday Plugin: A Repack of Date Picker from Projectify

Thank you @Mohammad for the quick update.

Can you make pikaday date picker the default one for the the shiraz task manager if available rather than the browsers default date picker.

See this example.

In this first screenshot, I picked the due field using pikaday date picker from the tiddler subtitle and the date format of due field in the tiddler looks like this.

And the due field in the task manager dynamic table (here Readinglist) looks like as shown below.

Now when I try to enter the due field directly from the task manager dynamic table (here Readinglist), instead of pikaday date picker, browser’s default date picker is shown.

Now the date format in the due field of the tiddler is different.

Is there a way to bring consistency in the date format used. I think the best way must be to make pikaday date picker the default one for the the shiraz task manager if available rather than the browsers default date picker.

Thank you.

This makes Shiraz more complex and dependent to Pikaday, as you need to install Pikaday in advance.

I would recommend to have your own column template for this.

I think you have discussed it before in some other post in the past. I will search the forum first and will ask your help if needed.

Shiraz has good documentation for creating custom column template.

Another problem I am facing is - if I use pikaday date picker from the tiddler subtitle, due field is getting created. But if I use the date picker from the dynamic table, the due-date field is getting created. There is an issue because of this - if I use both these date pickers on the same task or tiddler at two different times, the tiddler will have both the due and due-date fields. The date of these two fields will obviously be different unless I change both the due and due-date fields whenever I am altering one of the date fields. The dynamic tables code wont work correctly if there are two fields - due and due-date with two different dates.

I do not think so. dynamic tables create the field if not given from the list of fields when you call dynamic table.

<<table-dynamic fields:"f01 f02"

In edit mode if you have not f01, it will be created

I think I didn’t convey the issue correctly.

Based on these discussions - 1 and 2, I use the code given below to extract all the todos with due-date same as that of the date of journal tiddler.

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>

If there are both due and due-date fields for the same todo with two different dates, the above given code wont work correctly. This is my concern.

This is right! As both assumed the same. So, you need one field not two!
If you have many tiddlers with two fields or you want to change due-date to due simply use Commander, it can remove one, or rename or merge,…

This is not an issue with previous tiddlers…i don’t have huge amount of todo tiddlers for removing fields. The problem is I have to always keep on doing this correction if I plan to use Pikaday. One way is to not use pikaday. But obviously pikaday has certain advantages like date picker availability in subtitle which I like to make use of.

My workflow is to use Pikaday in view mode. It can be added using a viewtemplate. You can have also on subtitle. In edit mode of table, I do not touch due field. This is correct when you edit a todo on its own tiddler.

By the way, if you are insisted to use pickaday on edit mode, then your due column template should just transclude the pikday button, no difference between view/edit.

The extra works is to use css to have it nicely positioned inside a table cell.

This is the code for due-date coulmn template


\define showCell()
<$set tiddler=<<currentRecord>> field=<<currentColumn>> name=due-date>
<$text text={{{[<due-date>split[-]split[.]join[]format:date[YYYY.0MM.0DD]]}}} />
</$set>
\end
\define showCell_Locked() <span style="font-style:oblique;"><<showCell>></span>
\define edit_date() <$edit-text tag=input type=date tiddler=<<currentRecord>> field=<<currentColumn>>/>
<$reveal type="nomatch" stateTitle=<<tempTableEdit>> stateIndex="mode" text="edit" tag="td" class="shiraz-dtable-date">
<<showCell>>
</$reveal>
<$reveal type="match" stateTitle=<<tempTableEdit>> stateIndex="mode" text="edit" tag="td">
<!--check if the current column is not selected for sorting-->
<$list filter="[<tempTableSort>getindex[sortIndex]match<currentColumn>]" variable=ignore
emptyMessage=<<edit_date>> >
 <<showCell_Locked>>
</$list>
</$reveal>

<!-- Part of Task Manager
  this template ALWAYS works on fields -->

How and where to transclude the pikaday button here. When I tried, selecting date for due field for one todo changes the date for all todos to the same date.

Please try this

<$tiddler tiddler=<<currentRecord>>  >
{{||$:/plugins/kookma/pikaday/ui/buttons/TodoDueDate}}
</$tiddler>

This one is working…but I will have do some css tweaking to adjust the position of date-picker…date picker is appearing well above the tiddler with dynamic table.

Does this code need some modification (other than changing due-date to due) …the todos are not getting collected in the corresponding journal tiddler…

I think you are on the right track.

Yes, the CSS part needs more work. That is why I stick with pikaday in view mode!

Umm… I wonder if would be possible to have something that adds hour information to the pick a day widget. So if it is clicked would allow to be more specific and if not, it just add info about the date.

I have no idea! as it needs JS.

Mohammad and all,

Tagging on with interest for adding hours, simply because – at present – this is the only way for people west of GMT0 to get dates to work properly.

The pikaday and related tools fail “out of the box” for those of us in “negative” time zones: In a dynamic table date picker, I pick Sept 1 in edit mode, and when I return to view mode the display shows Aug 31.

I can make the offset manually when I type into a regular date field (by adding a time suffix like 12 [or even 9!] after the date, as in 2022090112).

I do wish we we could all, as a community, find a way to have a timezone setting somewhere that just works for things like a date picker. If we could do that, maybe Pikaday could check that time-zone offset and automatically adjust to consider midnight “my time” in getting the date string (even if time-specification isn’t added to the picker).

-Springer

I believe pikaday does this automatically!
I just tested and it creates a date like below

20220915120000000

Would you please test this using the online demo!

Mohammad,

My mistake. It was in Shiraz that the in-column date picker (in the task-manager’s due date column for example) was yielding the wrong date as soon as I would switch from edit (which would show the date I intended) to display mode (which would show the date before). This is as true on your demo site (as it loads for me in my backwards time zone) as in my own installations of Shiraz:

https://kookma.github.io/TW-Shiraz/#demo%2Fdynamic-table%2Ftask-manager

-Springer

@Springer

I am not sure whether this is related to your issues with timezone.
Just take a look at this discussion where Eric talks about similar timezone issues - How to filter by due date of today in shiraz dynamic table - #25 by EricShulman
It may be of help for you.