1

I have the following template:

<f:for each="{matchday.matches}" as="match" iteration="matchIterator">
<f:if condition="{match.home_team._id} == {team}">
    <f:render section="match" arguments="{match: match, is_home: 1, round_number: matchday.round_number}" />
</f:if>
<f:if condition="{match.away_team._id} == {team}">
    <f:render section="match" arguments="{match: match, is_home: 0, round_number: matchday.round_number}" />
</f:if>

All entries are sorted by Id. matches has an attribute play_date which contains the correct date of the match.

How I can sort the array by date before output?

I already tried using SortViewHelper but it didn't work:

<f:for each="{matchday.matches->v:iterator.sort(order: 'ASC', sortBy:'play_date')}" as="match" iteration="matchIterator">
Marlon
  • 197
  • 2
  • 16
  • sorting on dates may result in strange orders as the dates need to be formated to compare. if this is done in something other than japanese format (YYYYMMDD) or timestamp the result may look random. – Bernd Wilke πφ Sep 25 '17 at 13:01
  • Can‘t you order your relation instead of doing it in the template? I mean, do you need another sorting of `matchday.matches`? If it were e.g. an IRRE relation [foreign_default_sortby](https://docs.typo3.org/typo3cms/TCAReference/ColumnsConfig/Type/Inline.html#foreign-default-sortby) might be a good place to start… – undko Sep 25 '17 at 13:44

0 Answers0