Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 429c9074673c2c1a12613356bff36b3d61d42b3e 1 parent 30ee826
@snarlygoster authored
View
1  timeclock/templatetags/__init__.py
@@ -0,0 +1 @@
+##
View
8 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)
Please sign in to comment.
Something went wrong with that request. Please try again.