I have a simple model "item" with 3 properties: title, description, date
Now I want to have a list like this:
10.10.17:
title item 1
title item 5
12.10.17:
title item 8
and so on
According to groupedFor - grouping objects according to dates
I added a getter like
/**
* Get day month year of datetime
*
* @return int
*/
public function getDayMonthYearOfDatetime()
{
return (int)$this->datum->format('dmy');
}
My list view:
<f:groupedFor each="{items}" as="dayMonthYearOfDatetime" groupBy="dayMonthYearOfDatetime" groupKey="datum">
<tr>
<th>{datum}</th>
</tr>
<f:for each="{dayMonthYearOfDatetime}" as="calendar">
<tr>
<td>{item.title}</td>
</tr>
</f:for>
</f:groupedFor>
Now I get the following output:
101017 title item 1 title item 5
121017 title item 8
How to diplay the correct date "10.10.17" instead "101017"?
If I change my getter to:
return (int)$this->datum->format('d.m.y');
It doesn't work.