How to get today date in Jinja template ( Email Template)

I have child table, items and i need to filter the item whose item_date is less than today’s date.
I need to send an email so i created a email template like below

{% for row in item_details %}
{% if row.date < frappe.utils.today() %}
{{ row.item_name }}
{% endif %}
{% endfor %}

Am getting syntax error. How to get date in jinja template and filter the specific item.
Is frappe.utils.today() works in jinja template?

@madhusona it’s frappe.utils.getdate()
also use it to convert row.date from str to date.

{% if frappe.utils.getdate(row.date) < frappe.utils.getdate() %}

@bahaou Still getting “Syntax error in template”. Am using frappe V14

@madhusona can you share screenshots . it works fine with me

@bahaou Thanks. Also how to troubleshoot this type of errors. Am getting only alert

@madhusona try to use html not text editor

1 Like

It’s Worked. What is the problem in text editor?

@madhusona I don’t think it’s compiled with jinja