TYPO3, Fluid template. Display a div if the date of today is between 05/01 and 10/01

548 views Asked by At

I want to display a div if the date of today is between "05/01" and "10/01". Could someone please help me with it? :)

I could only display it when the date is between "01/01" and "10/01" by writing this code:

<f:if condition="{f:format.date(date: '10/01' format: 'm/d')} < {f:format.date(date: 'now', format: 'm/d')}">
                <f:then><div>The Store is closed.</div></f:then>
                <f:else><div>The Store is open!</div></f:else>
</f:if>

Many thanks in advance!

1

There are 1 answers

2
Mikel Wohlschlegel On BEST ANSWER

Combine two conditions by "&&"

<f:if condition="{f:format.date(date: 'today', format: 'Y-m-d')} >=
{f:format.date(date: '2019/02/27', format: 'Y-m-d')} && {f:format.date(date:
'today', format: 'Y-m-d')} <= {f:format.date(date: '2019/03/01', format: 'Y-m-d')}">
  <f:then>
    <div>The Store is closed.</div>
  </f:then>
  <f:else>
     <div>The Store is open!</div>
  </f:else>
</f:if>

Condition 1 (date of today equal or larger Feb 27):

{f:format.date(date: 'today', format: 'Y-m-d')} >= {f:format.date(date: '2019/02/27', format: 'Y-m-d')}

Condition 2 (date of today less or equal March 01):

{f:format.date(date:'today', format: 'Y-m-d')} <= {f:format.date(date: '2019/03/01', format: 'Y-m-d')}