summaryrefslogtreecommitdiff
path: root/babel/support.py
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2013-07-05 20:53:51 +0200
committerArmin Ronacher <armin.ronacher@active-4.com>2013-07-05 20:53:51 +0200
commit5204709d3a3f11ef8c5bb7d0dd64f69ee46b47ab (patch)
treee4b225024499a168353baeb1af9fddacf2935a44 /babel/support.py
parent72d681aa0f52eb33c92d0c0d4848597472d350c7 (diff)
downloadbabel-5204709d3a3f11ef8c5bb7d0dd64f69ee46b47ab.tar.gz
Greatly improved timedelta formatting
Diffstat (limited to 'babel/support.py')
-rw-r--r--babel/support.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/babel/support.py b/babel/support.py
index 80f015c..ba45ad9 100644
--- a/babel/support.py
+++ b/babel/support.py
@@ -88,17 +88,20 @@ class Format(object):
"""
return format_time(time, format, tzinfo=self.tzinfo, locale=self.locale)
- def timedelta(self, delta, granularity='second', threshold=.85):
+ def timedelta(self, delta, granularity='second', threshold=.85,
+ format='medium', add_direction=False):
"""Return a time delta according to the rules of the given locale.
>>> fmt = Format('en_US')
>>> fmt.timedelta(timedelta(weeks=11))
- u'3 mths'
+ u'3 months'
:see: `babel.dates.format_timedelta`
"""
return format_timedelta(delta, granularity=granularity,
- threshold=threshold, locale=self.locale)
+ threshold=threshold,
+ format=format, add_direction=add_direction,
+ locale=self.locale)
def number(self, number):
"""Return an integer number formatted for the locale.