Opened 15 years ago
Last modified 14 years ago
#8662 closed enhancement
format date in RFC 3339 subset (profile) of ISO 8601 — at Initial Version
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | 0.12 |
Component: | rendering | Version: | 0.11-stable |
Severity: | normal | Keywords: | patch |
Cc: | martin@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
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 http://www.ietf.org/rfc/rfc3339.txt
-
trac/util/datefmt.py
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
Note:
See TracTickets
for help on using tickets.