Hi,
I have a blueprint with layout:table and showing a date field from the child in a column.
In the config.php I did set the date handler to ‘intl’ and in the template it works as expected, but in the panel some dates are not formatted correctly.
I can change the date in the second entry (see image below) for example to today or yesterday, and then it’s showing the date as expected.
title: Aktuell
sections:
pages:
type: pages
label: Aktuell
template: aktuell-eintrag
sortBy: datum desc
layout: table
columns:
title:
label: Titel
datum:
label: Datum
value: "{{ page.datum.toDate('dd. MMMM YYYY') }}"
width: 1/4
What am I doing wrong?
Any help would be much appreciated.
Thanks.
Could you test with type: html
like following please?
datum:
type: html
label: Datum
value: "{{ page.datum.toDate('dd. MMMM YYYY') }}"
width: 1/4
Wow, that was quick. Thank you very much, it’s working!
Did I miss something in the docs?
Page and files section with table layout will now try to infer the column type from the blueprint of the first model when no type has been provided explicitly #6147
From 4.1.0 onwards, column data is automatically output according to field type. Since datum
field is date
, it provides an automatic output. Therefore, if the column type is set to html
, the desired custom output can be obtained.
This very issue still persists for me on 4.4.0 and 4.4.1. Adding type: html
in the section where the page date is previewed is the only thing that works.
@distantnative is that not the same problem? Column preview is supposed to be inferring (+ in this case, parsing the date field into a previewable format) the field type from the original field in the page blueprint, without me having to add a type to it to display the date correctly? That’s what I understood from the bug fix description in 4.1.0.
Not if you are defining the value itself, e.g.
value: " {{ page.startDate.toDate('dd.MM.yyyy') }} "
cause then the value will be in a different format than needed for the date field preview - and when then the date field preview is applied, inconsistent results appear.
So best to either set the value and type: text
or let the field defaults play out fully.