Less than/more than in template

Hello all,

I have a template that takes a date in a helper and compares it to today’s date. If it’s less than today’s date, the date shows up on my dashboard, and if it’s the same date it will not. This is just how I need it. The only problem is that I don’t know how to use “equal or less than” so as soon as the next day comes the date will show on my dashboard again.

Anyone know how to achieve this?

This is my template:

{% if states.sensor.date.state == states.input_datetime.helper_dato_for_hjemmekontor.state %}
{% else %}
{{ state_attr("input_datetime.helper_dato_for_hjemmekontor", "timestamp") | timestamp_custom("%d %B") }}
{% endif %}

I got help from a legend on Discord :slight_smile: This is what he gave me (if anyone else is trying to do the same)

{% if now().date() < as_datetime(states('input_datetime.helper_dato_for_hjemmekontor')).date() %}   {{ as_datetime(states('input_datetime.helper_dato_for_hjemmekontor')).strftime('%d %B') }}
{% endif %}
{% set dt = states('input_datetime.helper_dato_for_hjemmekontor') | as_datetime %}
{{ dt.strftime('%d %B') if dt.date() < now().date() }}