Skip to content

Commit

Permalink
Fix datetime formatting on windows (issue jbalogh#23) by replacing %e…
Browse files Browse the repository at this point in the history
… with %d,

this is the least complicated method of doing things but will cause
inconsistent behavior across systems.

Anyone has another suggestion?
  • Loading branch information
asfaltboy committed Jan 4, 2013
1 parent f44931d commit 02850af
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion jingo/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django.core.urlresolvers import reverse

import jinja2
import platform

from jingo import register

Expand Down Expand Up @@ -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''


Expand Down

0 comments on commit 02850af

Please sign in to comment.