Skip to content

Instantly share code, notes, and snippets.

@george-silva
Created January 23, 2015 13:51
Show Gist options
  • Save george-silva/6d13219cb23f3fa3f978 to your computer and use it in GitHub Desktop.
Save george-silva/6d13219cb23f3fa3f978 to your computer and use it in GitHub Desktop.
Templatetag to limit the output of timeuntil.
from django.template import Library
register = Library()
@register.filter
def split_timeuntil(duration, chunks=1):
return ", ".join(duration.split(",")[0:chunks])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment