Source

trac-1942 / complete-usertime.patch

Full commit
# HG changeset patch
# Parent d05cb61b36696d6306a88b08abc13e49ca78b6e0
Add `user_time` to TicketQueryMacro too.

diff --git a/trac/ticket/templates/query_results.html b/trac/ticket/templates/query_results.html
--- a/trac/ticket/templates/query_results.html
+++ b/trac/ticket/templates/query_results.html
@@ -77,9 +77,9 @@
                       <a py:when="name == 'summary'" href="$result.href" title="View ticket">$value</a>
                       <py:when test="isinstance(value, datetime)">
                         <py:choose test="header.field.format">
-                          <py:when test="'age'">${dateinfo(value)}</py:when>
-                          <py:when test="'date'">${format_date(value, tzinfo=req.tz)}</py:when>
-                          <py:otherwise>${format_datetime(value, tzinfo=req.tz)}</py:otherwise>
+                          <py:when test="'age'">${pretty_dateinfo(value)}</py:when>
+                          <py:when test="'date'">${user_time(req, format_date, value)}</py:when>
+                          <py:otherwise>${user_time(req, format_datetime, value)}</py:otherwise>
                         </py:choose>
                       </py:when>
 <!--!
diff --git a/trac/web/chrome.py b/trac/web/chrome.py
--- a/trac/web/chrome.py
+++ b/trac/web/chrome.py
@@ -919,6 +919,7 @@
             'fromtimestamp': partial(datetime.datetime.fromtimestamp,
                                      tz=req and req.tz),
             'from_utimestamp': from_utimestamp,
+            'user_time': user_time,
 
             # Wiki-formatting functions
             'wiki_to': partial(format_to, self.env),