Search code examples
formatconditional-statementsfluidtypo3-6.2.xviewhelper

TYPO3 viewhelper date in condition


I want to compare two dates in a condition with fluid in an extension in Typo3 6.2. Here is, what I have tried for now:

<f:if condition="{f:format.date(format : 'U', date : {orderdate})}
>= {f:format.date(format : 'U', date : {v:system.dateTime()})}">
  <f:then>
    do it
  </f:then>
  <f:else>
    do it not
  </f:else>
</f:if>

The viewhelper {v:system.dateTime()} from the vhs-extension returns the timestamp. But this code returns only the condition from the "then" statement. The condition is not working in this way...

My question is, how can I compare two dates within fluid? Does anybody know a solution?


Solution

  • I found this solution: The code functions, when I write the condition in better inline style:

    <f:if condition="{kurse.anmeldedate -> f:format.date(format : 'U')} >
    {v:system.dateTime() -> f:format.date(format : 'U')}">
       <f:then>
          do it
       </f:then>
       <f:else>
         do it not
       </f:else>
    </f:if>
    

    The Viewhelper v:system.dateTime() gives the time now as a timestamp and is a VH from the extension VHS: Fluid ViewHelpers.