Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Django naturaltime with only one time denomination, no comma
@register.filter
def short_naturaltime(value):
from django.contrib.humanize.templatetags.humanize import naturaltime
base = naturaltime(value)
if ',' not in base:
return base
return base.split(',', 1)[0] + ' ago'
@FlorianBouron

This comment has been minimized.

Copy link

@FlorianBouron FlorianBouron commented Apr 23, 2017

Looks great, but this work only for ENGLISH language, do you have an idea for a multilingual website?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.