Is there a way to use the {{date|timesince}}
filter, but instead of having two adjacent units, only display one?
For example, my template is currently displ
I can't think of a simple builtin way to do this. Here's a custom filter I've sometimes found useful:
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter
@stringfilter
def upto(value, delimiter=None):
return value.split(delimiter)[0]
upto.is_safe = True
Then you could just do
{{ date|timesince|upto:',' }}