Checking to see if a date has expired

Hi I’m trying to check if a datetime stamp has expired. I’ve set two variables that correctly pull the date to be checked (end_date) and the current date (current_date):

{% set current_date = unixtimestamp(local_dt) | format_datetime('medium', local_time_zone) %}
{% set end_date = module.end_date_and_time | format_datetime('medium', local_time_zone) %}

 {% if current_date >= end_date %}
 the date has expired
 {% else %}
 the date has yet to pass
 {% endif %} 

This doesn’t work though - could anyone point me in the right direction please?

Thanks!

Hey, @DM2 :waving_hand: What if we tried comparing Unix timestamps directly? Meaning,

{% set current_timestamp = unixtimestamp(local_dt) %}
{% set end_timestamp = unixtimestamp(module.end_date_and_time) %}

vs

{% set current_date = unixtimestamp(local_dt) | format_datetime('medium', local_time_zone) %}
{% set end_date = module.end_date_and_time | format_datetime('medium', local_time_zone) %}

So that we are comparing the actual numeric vales and not formatted date strings.

Please let us know if you get it working.

Have fun building! — Jaycee

thank you @Jaycee_Lewis that works perfectly.