Hello,
In my project I need to convert from Gregorian to Arabic Hijri date, I need to print the current printing date in Hijri
This is my code, I use umalqurra library for that:
from umalqurra.hijri_date import HijriDate
import datetime
def hijry():
datee = datetime.datetime.strptime(frappe.utils.today(), "%Y-%m-%d")
um = HijriDate(datee.year,datee.month,datee.day,gr=True)
print int(um.year), um.month_name , int(um.day)
I change this code to jinja like follow:
{% set datee = datetime.datetime.strptime(frappe.utils.today(), "%Y-%m-%d") %}
{% set um = HijriDate(datee.year,datee.month,datee.day,gr=True) %}
{{ int(um.day) }}
When I check print format, it shows this error
UndefinedError: ‘datetime’ is undefined
I try to include it in jinja like this :
{% import datetime %}
{% from umalqurra.hijri_date import HijriDate %}
But it still the same!
Any solution
thanks