#8662 (format date in RFC 3339 subset (profile) of ISO 8601) – The Trac Project (original) (raw)

Context Navigation


Modify

#8662 closed enhancement (fixed)

Reported by: Owned by: techtonik@…
Priority: normal Milestone: 0.12
Component: rendering Version: 0.11-stable
Severity: normal Keywords: patch
Cc: martin@… Branch:
Release Notes:
API Changes:
Internal Changes:

Currently util.datefmt.format_datetime() is able to produce ISO 8601 compliant format given 'iso8601' as argument. The proposal is to increase interoperability by making datetime format compliant with RFC 3339 profile of ISO 8601.

That means that date will still be ISO 8601, but it will be additionally suitable for generating output that uses RFC 3339 based datetime, such as Atom.

See ​rfc:3339#section-5.6

| | | | |
| ---------- | ------------------------------------------------------------------ | -------------------------------------------------------------------------- |
| 100 | 100 | |
| 101 | 101 | The formatting will be done using the given `format`, which consist |
| 102 | 102 | of conventional `strftime` keys. In addition the format can be 'iso8601' |
| 103 | | to specify the international date format. |
| | 103 | to specify the international date format (compliant with rfc3339). | |
| 104 | 104 | |
| 105 | 105 | `tzinfo` will default to the local timezone if left to `None`. |
| 106 | 106 | """ |
| | | |
| 125 | 125 | text = t.strftime(format) |
| 126 | 126 | if normalize_Z: |
| 127 | 127 | text = text.replace('+0000', 'Z') |
| | 128 | text = text[:-2] + ":" + text[-2:] | |
| 128 | 129 | encoding = locale.getpreferredencoding() or sys.getdefaultencoding() |
| 129 | 130 | if sys.platform != 'win32' or sys.version_info[:2] > (2, 3): |
| 130 | 131 | encoding = locale.getlocale(locale.LC_TIME)[1] or encoding |

Attachments(2)

Change History(18)

Description: modified (diff)
Milestone: → 0.12
Resolution: → fixed
Status: new → closed
Owner: changed from Remy Blank to techtonik@…
Cc: martin@… added
Resolution: fixed
Status: closed → reopened
Owner: changed from techtonik@… to Remy Blank
Status: reopened → new
Resolution: → fixed
Status: new → closed
Owner: changed from Remy Blank to techtonik@…

Modify Ticket

AttachmentsDescription

Review any modifications above, and any conflicts in the preview below.

by anonymous

Note: See TracTickets for help on using tickets.