From 02850af10710e12c0bfeb477fb93e2609b3842dc Mon Sep 17 00:00:00 2001 From: Pavel Savchenko Date: Fri, 4 Jan 2013 17:59:06 +0200 Subject: [PATCH] Fix datetime formatting on windows (issue #23) by replacing %e with %d, this is the least complicated method of doing things but will cause inconsistent behavior across systems. Anyone has another suggestion? --- jingo/helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jingo/helpers.py b/jingo/helpers.py index 5c1120e..62dad83 100644 --- a/jingo/helpers.py +++ b/jingo/helpers.py @@ -4,6 +4,7 @@ from django.core.urlresolvers import reverse import jinja2 +import platform from jingo import register @@ -53,7 +54,10 @@ def nl2br(string): def datetime(t, fmt=None): """Call ``datetime.strftime`` with the given format string.""" if fmt is None: - fmt = _('%B %e, %Y') + if platform.system() == "Windows": + fmt = _('%B %d, %Y') + else: + fmt = _('%B %e, %Y') return smart_unicode(t.strftime(fmt.encode('utf-8'))) if t else u''