From 08a6727fb85298dcf9835c575ef8b96c134fdede Mon Sep 17 00:00:00 2001 From: Raghavendra Kamath Date: Tue, 20 Feb 2018 17:25:33 +0530 Subject: [PATCH] Add date format configurability to date format function (#5037) --- frappe/utils/data.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/utils/data.py b/frappe/utils/data.py index e60b2fca37..d8ca8c16ef 100644 --- a/frappe/utils/data.py +++ b/frappe/utils/data.py @@ -254,10 +254,10 @@ def format_datetime(datetime_string, format_string=None): formatted_datetime = datetime.strftime('%Y-%m-%d %H:%M:%S') return formatted_datetime -def global_date_format(date): +def global_date_format(date, format="long"): """returns localized date in the form of January 1, 2012""" date = getdate(date) - formatted_date = babel.dates.format_date(date, locale=(frappe.local.lang or "en").replace("-", "_"), format="long") + formatted_date = babel.dates.format_date(date, locale=(frappe.local.lang or "en").replace("-", "_"), format=format) return formatted_date def has_common(l1, l2):