I need to display an entry only if the date fields within its Matrix are current. So, only display if the startDate
is greater than or equal to today and the endDate
is less than or equal to today.
Currently I have this code and am having trouble finding how to compare multiple dates.
{% for entry in craft.entries.section('sectionHandle') %}
{% set present = now|date %}
{% set entryStart = entry.matrixHandle.startDate %}
{% set entryEnd = entry.matrixHandle.endDate %}
{% if entryStart >= present and entryEnd <= present %}
display entry information
{% endif %}
{% endif %}
I'm guessing that I'm using the operators incorrectly or that "and" isn't allowed. Either way, it's not displaying anything and yes, I have a made sure that I have an entry with dates that would activate this if statement.