Global Date Format Localisation (#3428)

* Global Date Format localization

* Addition of the long format

* Update method description
This commit is contained in:
Faris Ansari 2017-06-05 11:49:54 +05:30 committed by GitHub
parent 96c8d959af
commit 0e04d386e4

View file

@ -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"""