Procházet zdrojové kódy

localize_date using babel

version-14
Anand Doshi před 11 roky
rodič
revize
f635f9aecc
1 změnil soubory, kde provedl 5 přidání a 5 odebrání
  1. +5
    -5
      frappe/utils/__init__.py

+ 5
- 5
frappe/utils/__init__.py Zobrazit soubor

@@ -5,12 +5,9 @@

from __future__ import unicode_literals
from werkzeug.test import Client
import os, sys
import re
import urllib
import os, sys, re, urllib, datetime, math
import babel.dates
import frappe
import datetime
import math

no_value_fields = ['Section Break', 'Column Break', 'HTML', 'Table', 'FlexTable',
'Button', 'Image', 'Graph']
@@ -264,6 +261,9 @@ def global_date_format(date):
formatted_date = getdate(date).strftime("%d %B %Y")
return formatted_date.startswith("0") and formatted_date[1:] or formatted_date

def localize_date(date, format_string=None, locale=None):
return babel.dates.format_date(date, format_string or "medium", locale=locale or (frappe.local.lang or "").replace("-", "_"))

def dict_to_str(args, sep='&'):
"""
Converts a dictionary to URL


Načítá se…
Zrušit
Uložit