Antlers: Unexpected token when accessing var

I'm using the following in a collection call:

{{ collection from="discounts|competition" limit="6" as="posts" starts_on:gt="{today format='Y-m-d'}" sort="starts_on:asc" }}

This works as expected on any test I made.

But when using the following in a condition...

{{ if entry:starts_on:gt="{today format='Y-m-d'}" }}

I get this error:

syntax error, unexpected token "=" on line 1 of: <?php if (null="{today format='Y-m-d'}"): ?>

The date is set and correct. Is this condition not possible outside a collection call?

I also tried a few variations such as

{{ if (entry:starts_on|format="Y-m-d") > "{today format='Y-m-d'}" }}

or

{{ if (entry:starts_on format="Y-m-d") > (today | format="Y-m-d") }}

But had no luck either. It feels like I'm THIS close and miss a tiny detail.

Answered by Johnathon Koster!
>>>>>>> Answered <<<<<<<
2 Replies
2 Followers