0

I'm trying to setup a conditional to only show the Start Date when the Start Date and End Date match, but I can't get it to work in Matrix and I can't find a similar question anywhere.

Here's what I have so far. I'm using the Time Select fieldtype add-on.

{exp:channel:entries entry_id="8" dynamic="off"}
    {sessions}
        {if "{start_date format='%M %j'}" == "{end_date format='%M %j'}"}
            <li>{start_date format="%M %j"}</li>
        {if:else}
            <li>{start_date format="%M %j"} - {end_date format="%M %j"}</li>
        {/if}
    {/sessions}
{/exp:channel:entries}

2 Answers 2

1

EECMS saves dates as UNIX timestamps. You don't need to format the fields just to compare each other.

I don't know if Time Select uses something different, but it worth a try.

{exp:channel:entries entry_id="8" dynamic="off"}
    {sessions}
            <li>
               {start_date format="%M %j"}
               {if start_date != end_date} - {end_date format="%M %j"}{/if}
            </li>
        {/if}
    {/sessions}
{/exp:channel:entries}
0

Try to remove the the quotation marks:

  {if "start_date format='%M %j'" == "{end_date format='%M %j'}"}

Sometimes it needs to remove them with conditional.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.