Permalink
Browse files

Make the datestr output consistent on Windows and Unix.

On Unix, the datestr renders the day without the leading zero, like
"June 3" where as on windows, it used to give "June 03".

Thanks @sboden for reporting this issue and PR and @jzellman for
additional comments.

Issue #348
  • Loading branch information...
1 parent 47ad18d commit b725a4f7dda3114c626ccdf7a7004c21efb8ba8b @anandology anandology committed Jun 15, 2017
Showing with 3 additions and 5 deletions.
  1. +3 −5 web/utils.py
View
@@ -913,11 +913,9 @@ def agohence(n, what, divisor=None):
if abs(deltadays) < 4:
return agohence(deltadays, 'day')
- try:
- out = then.strftime('%B %e') # e.g. 'June 3'
- except ValueError:
- # %e doesn't work on Windows.
- out = then.strftime('%B %d') # e.g. 'June 03'
+ # Trick to display 'June 3' instead of 'June 03'
+ # Even though the %e format in strftime does that, it doesn't work on Windows.
+ out = then.strftime('%B %d').replace(" 0", " ")
if then.year != now.year or deltadays < 0:
out += ', %s' % then.year

0 comments on commit b725a4f

Please sign in to comment.