Opened 5 years ago

Closed 5 years ago

#16416 closed New feature (fixed)

date template tag should support "e" and "o" format character

Reported by: Carsten Fuchs Owned by: Dan Poirier
Component: Template system Version: 1.3
Severity: Normal Keywords: ISO 8601
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The date template tag currently supports the "W" (ISO 8601 week number) format character, but not the complementing "o" (ISO 8601 year number machting the ISO week number) character.

Both are described at the documentation that the date template tag is referring to:
http://de2.php.net/manual/en/function.date.php

A workaround is possible with a custom template tag, returning the result of datetime.strftime("%G").

Attachments (1)

16416.diff (4.6 KB) - added by Dan Poirier 5 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 5 years ago by Aymeric Augustin

Summary: date template tag should support "o" format characterdate template tag should support "e" and "o" format character
Triage Stage: UnreviewedAccepted

Here's a list of the differences between what PHP supports and what Django supports:

b => added in Django
B => not implemented in Django
E => added in Django
e => not available in Django, added in PHP 5.1.0
f => added in Django
I => not implemented in Django
N => added in Django, added in PHP 5.1.0 with a different meaning
o => not available in Django, added in PHP 5.1.0
P => added in Django, added in PHP 5.1.3 with a different meaning

We should implement e and o, or mention in the docs that they're not implemented, like B and I.

Also, given the divergence of N and P, maybe we'd better drop the reference to PHP from the docs.

Last edited 5 years ago by Aymeric Augustin (previous) (diff)

comment:2 Changed 5 years ago by Dan Poirier

Owner: changed from nobody to Dan Poirier
Status: newassigned

Changed 5 years ago by Dan Poirier

Attachment: 16416.diff added

comment:3 Changed 5 years ago by Dan Poirier

Has patch: set

comment:4 Changed 5 years ago by Jannis Leidel

Triage Stage: AcceptedReady for checkin

comment:5 Changed 5 years ago by Jannis Leidel

Resolution: fixed
Status: assignedclosed

In [17473]:

Fixed #16416 -- Added two new date formatting options for timezones and ISO week numbers. Thanks, poirier.

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