From 0e04d386e4aae016e151feaeb7847cf71d2daf5a Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 5 Jun 2017 11:49:54 +0530 Subject: [PATCH] Global Date Format Localisation (#3428) * Global Date Format localization * Addition of the long format * Update method description --- frappe/utils/data.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frappe/utils/data.py b/frappe/utils/data.py index 067d5a4650..a94254f551 100644 --- a/frappe/utils/data.py +++ b/frappe/utils/data.py @@ -245,9 +245,10 @@ def format_datetime(datetime_string, format_string=None): return formatted_datetime def global_date_format(date): - """returns date as 1 January 2012""" - formatted_date = getdate(date).strftime("%d %B %Y") - return formatted_date.startswith("0") and formatted_date[1:] or formatted_date + """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") + return formatted_date def has_common(l1, l2): """Returns truthy value if there are common elements in lists l1 and l2"""