Browse Source

Fix time_since filter on py3. It interprets FP numbers < 1 differently than py2 does

Casper Van Gheluwe 10 years ago
parent
commit
292fd2e55b
1 changed files with 2 additions and 3 deletions
  1. 2 3
      flaskbb/utils/helpers.py

+ 2 - 3
flaskbb/utils/helpers.py

@@ -340,11 +340,10 @@ def time_delta_format(dt, default=None):
     )
 
     for period, singular, plural in periods:
-
-        if not period:
+        if period < 1:
             continue
 
-        if period == 1:
+        if 1 <= period < 2:
             return u'%d %s ago' % (period, singular)
         else:
             return u'%d %s ago' % (period, plural)