Add jalali date formatting utility and update invoice generation
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import jdatetime
|
||||
from django.utils import timezone
|
||||
|
||||
def to_jalali(dt):
|
||||
if not dt:
|
||||
return None
|
||||
|
||||
dt = timezone.localtime(dt)
|
||||
|
||||
return jdatetime.datetime.fromgregorian(
|
||||
year=dt.year,
|
||||
month=dt.month,
|
||||
day=dt.day,
|
||||
hour=dt.hour,
|
||||
minute=dt.minute,
|
||||
second=dt.second,
|
||||
)
|
||||
Reference in New Issue
Block a user