I have a date field on a node – set to a custom date format (c which is ISO) in the Manage Display. I have a twig template checking to see if that date field comes before today, in which is should output Past. Outputting the fields/comparison values gets me the properly formatted dates I want to compare.
{{ content.field_closing_date.0 }} {{ 'now'|date('c') }}
which outputs
2021-05-05T16:30:00-07:00 2021-05-14T12:01:53-07:00
My comparison is
{% if 'now'|date('c') > content.field_closing_date.0 %} Past {% endif %}
But it’s not outputting Past. What gives? You can see that the todays date does come after the date field.