django.contrib.humanize naturaday not working with USE_TZ = True
has anyone else run into the problem below?
I've converted all my datetime to tz aware, my default time zone in my setting file is
TIME_ZONE = 'America/New_York'
in a template, I display the following,
{{ event.eventTime|naturalday:"D M d"|capfirst}}
the date right now in EST is 5/12, in UTC is 5/13. The example event date is 1:30pm EST 5/13. The template displays the time in EST, however, USE_TZ = True, naturalday displays "Today" instead of "Tomorrow. If I turn off USE_TZ, then it displays "Tomorrow".
Looking at the code for humanize, it's just comparing the passed in value with date.today()
92 delta = value - date.today() 93 if delta.days == 0: 94 return _(u'today') 95 elif delta.days == 1: 96 return _(u'tomorrow')
and I believe my template is passing in the UTC datetime. Is there a way for me to change the date passed in to EST equivalent in the template?
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Ylz2Cz1-T8AJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home