Permalink
Browse files

tag to format timedelta as hours:minutes (converts days to 24 hours)

  • Loading branch information...
snarlygoster committed May 21, 2012
1 parent 30ee826 commit 429c9074673c2c1a12613356bff36b3d61d42b3e
Showing with 9 additions and 0 deletions.
  1. +1 −0 timeclock/templatetags/__init__.py
  2. +8 −0 timeclock/templatetags/timedelta.py
@@ -0,0 +1 @@
+##
@@ -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.