Просмотр исходного кода

Global Date Format Localisation (#3428)

* Global Date Format localization

* Addition of the long format

* Update method description
version-14
Faris Ansari 8 лет назад
committed by GitHub
Родитель
Сommit
0e04d386e4
1 измененных файлов: 4 добавлений и 3 удалений
  1. +4
    -3
      frappe/utils/data.py

+ 4
- 3
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"""


Загрузка…
Отмена
Сохранить