#11197: django.utils.dateformat for 'W' is not correct
-----------------------------+----------------------------------------------
Reporter: [email protected] | Owner: nobody
Status: new | Milestone:
Component: Template system | Version: 1.0
Keywords: dateformat | Stage: Unreviewed
Has_patch: 0 |
-----------------------------+----------------------------------------------
I have a simple problem with the datebased view archive_week.
In the generic view is something like:
{{{
#!python
In [23]: date = datetime.date(*time.strptime('2009-0-22', '%Y-%w-%U')[:3])
In [24]: date
Out[24]: datetime.date(2009, 5, 31)
}}}
BUT the template-tag "date" does the following (and here's the bug):
{{{
#!python
In [19]: now = datetime.datetime.now()
In [20]: now
Out[20]: datetime.datetime(2009, 5, 25, 12, 2, 46, 964892)
In [21]: df = DateFormat(now)
In [22]: df.format("%W")
Out[22]: u'%22'
}}}
so my python installation tells me the first day of the 21st week of 2009
was yesterday, but my django installation tells me we have one day later
already the 22nd week wich is starting at 31st.
this is a real problem if you write something like this in your templates:
<a href="{% url aggregator_archive_week
year=entry.timestamp_created|date:"Y",
week=entry.timestamp_created|date:"W", slug=stream.slug %}">
--
Ticket URL: <http://code.djangoproject.com/ticket/11197>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---