Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
tag to format timedelta as hours:minutes (converts days to 24 hours)
Browse files Browse the repository at this point in the history
  • Loading branch information
snarlygoster committed May 21, 2012
1 parent 30ee826 commit 429c907
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions timeclock/templatetags/__init__.py
@@ -0,0 +1 @@
##
8 changes: 8 additions & 0 deletions timeclock/templatetags/timedelta.py
@@ -0,0 +1,8 @@
from django import template

register = template.Library()

@register.filter
def timedelta_fmt(td):
secs = td.seconds + td.days * 24 * 3600
return "%d:%02d" % (secs/3600, secs%3600/60)

0 comments on commit 429c907

Please sign in to comment.