Date fields in Shiraz Dynamic Table

In a dynamic table I’ve created using Shiraz, there’s a column that contains date in TiddlyWiki format.

Presently, it just displays the value as it is YYYYMMDDHHMMSSXXX.

I would like the display to be in YYYY-MM-DD ddd format.

How and where do I specify the column format?

Hi @deshmukh
I am not sure if I understand your question correctly

Have you seen Task Manager using dynamic table?

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

See it has a due-date field. In edit it shows a date picker, in view it shows what you said YYYY-0MM-0DD

You can use due-date field in your case!

1 Like

@Mohammad Thanks. The name of the field in my case is ‘published-on’. In the tiddler, it carries date value in TW date format. In the table it displays as the raw value, not in the required format.

Do I have to change the name of the field? Can the format be applied to ‘published-on’ field?

@deshmukh
The table Mohammad linked to is using column templates and explains the required fields.

@deshmukh - as explained by Birthe, the table uses column template. So,

  • if you have a field its name is due-date as above example, it will be displayed as image above
  • If you have other fields like published on but still you like to be displayed as due date do as below
    • open the plugin tiddler: $:/plugins/kookma/shiraz/templates/body/due-date
    • add the name your field (e.g. published-on) to tbl-column-list field in $:/plugins/kookma/shiraz/templates/body/due-date
  • Now dynamic table will treat the published-on field like due-date

Remarks

Shiraz dynamic table is very flexible and hackable. You can easily extend it to meet your requirements. For example you can have your own column template to render fields in special way.

See below doc

https://kookma.github.io/TW-Shiraz/#demo%2Fdynamic-tables-template

See how Task manager works

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

@Mohammad Thanks for bearing with me.

But something seems to be amiss. Field ‘tbl-column-list’ of tiddler ’ $:/plugins/kookma/shiraz/templates/body/due-date’ now carries ‘due-date some-date’.

A ‘Shiraz Test’ tagged ‘Test’ carries the following text:

<$macrocall $name=table-dynamic filter="[tag[Test]]" fields="tbl-checkbox tbl-expand title some-date" class="w-100" stateTiddler="your-state-tid" />

It has a field called ‘some-date’ that carries the value ‘20210913000000000’.

Still, the tiddler displays:

Shiraz Test 20210913000000000

What do I need to change?

1 Like

’ $:/plugins/kookma/shiraz/templates/body/due-date’ Go to field tbl-column-list give the value published-on

In the macro call you also need to use published on.

<$macrocall $name=table-dynamic filter="[tag[Test]]" fields="tbl-checkbox 
tbl-expand title published-on " class="w-100" stateTiddler="your-state-tid" />

Do you use the the some-date field in dynamic table to enter a date value into some-date?
Dynamic Table enters a human readable value into some-date!

See below clip shows how your example work

img_484_%pn

Or do you fill it manually? or do you fill it by some other widgets?
If so, you need to have your own column template

  • simply clone $:/plugins/kookma/shiraz/templates/body/due-date
  • fill in tbl-column-list with your filed name e.g published-on
  • change the body as you like to format your output (e.g use $view widget)

If still you have problem let me know!

@Mohammad Thanks. Finally, it seems to be working. Just one more thing.

I want to store date values in the field using TW format — YYYYMMDDHHMMSSXXX. But present them in the tiddler using YYYY-0MM-0DD ddd format.

How do I do that?

If you mean you have stored dates as YYYYMMDDHHMMSSXXX but want

  • to display them as yyyy-0mm-0dd ddd just use $view widget
    • example <$view field=published-on format=date template="YYYY-0MM-0DD ddd"/>
  • to display as custom in dynamic table, then use column template
1 Like

@Mohammad perfect. I use the $view widgets elsewhere. But how does one do that in a dynamic table under Shiraz?

‘Shiraz Test’ tiddler is tagged ‘Test’ and carries:

<<table-dynamic filter:"[tag[Test]]" fields:"title published-on" stateTiddler: "State Tiddler" editButton:"yes" >>

Where does the $view widget go?

See Date fields in Shiraz Dynamic Table - #8 by Mohammad