ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

How to calculate age from date of birth using jinja in print format..?

Sorry guys… can someone help me the idea on how i can use Jinja to calculate age from date of birth in print format, thanks.

Got it…

{% set dob = doc.date_of_birth  %}
{% set now  = frappe.utils.nowdate() %}
{% set diff = frappe.utils.date_diff(now, dob) %}
{% set year = diff//365 %}
{% set month = (diff - (year * 365))//30 %}
{% set day = ( (diff - (year * 365)) - (month * 30) ) %}
                
{{ year }} Years, {{ month }} Months, {{day}} Days