Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#883 closed defect (duplicate)

Problems with international date handling

Reported by: Petar Marić <petar.maric@…> Owned by: Adrian Holovaty
Component: Template system Version: master
Severity: major Keywords: translation date time i18n
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


The code:

{% load i18n %}
{% blocktrans with object.pub_date|date:_("DATETIME_FORMAT") as date %}Published on {{ date }}{% endblocktrans %}

Spits out:

AttributeError at /category/xml/
'str' object has no attribute 'day'
Request Method: 	GET
Request URL: 	http://localhost/category/xml/
Exception Type: 	AttributeError
Exception Value: 	'str' object has no attribute 'day'
Exception Location: 	C:\Dev\Python24\lib\site-packages\django\utils\ in d, line 114

Trace snip:


C:\Dev\Python24\lib\site-packages\django\utils\ in d

 107. = dt
 108. self.timezone = getattr(dt, 'tzinfo', None)
 109. if hasattr(, 'hour') and not self.timezone:
 110. self.timezone = LocalTimezone(dt)
 112. def d(self):
 113. "Day of the month, 2 digits with leading zeros; i.e. '01' to '31'"

 114. return '%02d' % #Here we get the error

 116. def D(self):
 117. "Day of the week, textual, 3 letters; e.g. 'Fri'"
 118. return WEEKDAYS[][0:3]
 120. def F(self):

I was able to reproduce the error with LANGUAGE_CODE set to 'sr', 'en' and 'de'.

Change History (2)

comment:1 Changed 12 years ago by Petar Marić <petar.maric@…>

Resolution: duplicate
Status: newclosed

Duplicate of #884 please delete (damn wireless connection)

comment:2 Changed 11 years ago by (none)

milestone: Version 1.0

Milestone Version 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top