Skip to content

Commit

Permalink
[#3012] Make time_ago i18n friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Nov 12, 2012
1 parent 0558ce7 commit e990585
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions ckan/lib/helpers.py
Expand Up @@ -21,7 +21,6 @@
from webhelpers.markdown import markdown
from webhelpers import paginate
from webhelpers.text import truncate
import webhelpers.date as date
from pylons import url as _pylons_default_url
from pylons.decorators.cache import beaker_cache
from pylons import config
Expand Down Expand Up @@ -812,8 +811,7 @@ def tzname(self, dt):

def time_ago_in_words_from_str(date_str, granularity='month'):
if date_str:
return date.time_ago_in_words(date_str_to_datetime(date_str),
granularity=granularity)
return formatters.localised_nice_date(date_str_to_datetime(date_str))
else:
return _('Unknown')

Expand Down
4 changes: 2 additions & 2 deletions ckan/templates/snippets/activity_item.html
Expand Up @@ -2,6 +2,6 @@
<i class="icon-{{ activity.icon }}"></i>
<p>
{{ h.literal(activity.msg.format(**activity.data)) }}
<span class="date">{{ h.time_ago_in_words_from_str(activity.timestamp, 'hour') }} ago</span>
<span class="date">{{ h.time_ago_in_words_from_str(activity.timestamp, 'hour') }}</span>
</p>
</li>
</li>

0 comments on commit e990585

Please sign in to comment.