Browse Source

localize_date using babel

version-14
Anand Doshi 11 years ago
parent
commit
f635f9aecc
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      frappe/utils/__init__.py

+ 5
- 5
frappe/utils/__init__.py View File

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


from __future__ import unicode_literals from __future__ import unicode_literals
from werkzeug.test import Client 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 frappe
import datetime
import math


no_value_fields = ['Section Break', 'Column Break', 'HTML', 'Table', 'FlexTable', no_value_fields = ['Section Break', 'Column Break', 'HTML', 'Table', 'FlexTable',
'Button', 'Image', 'Graph'] 'Button', 'Image', 'Graph']
@@ -264,6 +261,9 @@ def global_date_format(date):
formatted_date = getdate(date).strftime("%d %B %Y") formatted_date = getdate(date).strftime("%d %B %Y")
return formatted_date.startswith("0") and formatted_date[1:] or formatted_date 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='&'): def dict_to_str(args, sep='&'):
""" """
Converts a dictionary to URL Converts a dictionary to URL


Loading…
Cancel
Save