Forums/Tips & Tricks

How to show the event end date only if does not match the start date

Michael Slater
posted this on December 21, 2010, 22:54

To compare the start and end dates, you need to first create a variable to hold the end data, and then you can use the comparison logic:

<w:var name="event_start_date"><w:get name="event:start_date" /></w:var>
<p>Date: <w:get name="event:start_date" format="%d %B %Y" />  
      <w:unless condition='event:end_date == {{event_start_date}}' >to <w:get name="event:end_date"  format="%d %B %Y" /></w:unless>
</p>

The variable is required because the right-hand-side of a comparison must be a value, and cannot access a database value.