summaryrefslogtreecommitdiff
path: root/app/lib
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/templatetags/templatetags/html5_datetime.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/lib/templatetags/templatetags/html5_datetime.py b/app/lib/templatetags/templatetags/html5_datetime.py
new file mode 100644
index 0000000..20b5f27
--- /dev/null
+++ b/app/lib/templatetags/templatetags/html5_datetime.py
@@ -0,0 +1,16 @@
+from django.utils import dateformat
+import datetime
+from django import template
+from django.utils.safestring import mark_safe
+register = template.Library()
+
+@register.filter
+def html5_datetime(value):
+ """
+ Adds to colons to django's "Z" format to match html5 guidelines
+ """
+ fmt = "Y-m-d\TH:i:sO"
+ value = value
+ str = dateformat.format(value, fmt)
+ s = str[:-2] + ':' + str[-2:]
+ return mark_safe(s)