Code

Opened 3 years ago

Closed 2 years ago

#16416 closed New feature (fixed)

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

Reported by: CarstenF Owned by: 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 poirier 2 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 3 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from date template tag should support "o" format character to date template tag should support "e" and "o" format character
  • Triage Stage changed from Unreviewed to Accepted

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 3 years ago by aaugustin (previous) (diff)

comment:2 Changed 2 years ago by poirier

  • Owner changed from nobody to poirier
  • Status changed from new to assigned

Changed 2 years ago by poirier

comment:3 Changed 2 years ago by poirier

  • Has patch set

comment:4 Changed 2 years ago by jezdez

  • Triage Stage changed from Accepted to Ready for checkin

comment:5 Changed 2 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

In [17473]:

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.