Fluid compare dates

fluid, typo3

Solution

Assign your date to variable »yourdate«.

<f:if condition="{f:format.date(date: '+2 days', format: 'Y-m-d')} < {f:format.date(date: yourdate, format: 'Y-m-d')}">
    <f:then>
       yourdate is smaller than now + 2 days.
    </f:then>
    <f:else>
        yourdate is greater than or equal to now + 2 days.
    </f:else>
</f:if>

Problem

I want to compare two dates. I want to make a condition which checks if the date in my database is older than the date in two days. Here are my two variables: ``` {<f:format.date format="d.m.Y">+2 days</f:format.date>} {<f:format.date format="d.m.Y">{day.valid}</f:format.date>} ``` I want to solve this in the template, not in the model or the controller.

Original source