templatefilters: add filter to convert date to local date (issue1674)
authorHenrik Stuart <hg@hstuart.dk>
Sun, 24 May 2009 11:41:07 +0200
changeset 8591 08c93b07f5ad
parent 8590 59acb9c7d90f
child 8592 cc22b4168879
templatefilters: add filter to convert date to local date (issue1674) Issue1674 suggests the localdate filter be applied as default to log, but this patch only introduces the filter, not the changed default behaviour.
mercurial/help.py
mercurial/templatefilters.py
--- a/mercurial/help.py	Fri May 22 08:56:43 2009 +0200
+++ b/mercurial/help.py	Sun May 24 11:41:07 2009 +0200
@@ -341,6 +341,7 @@
     - hgdate: Date. Returns the date as a pair of numbers:
           "1157407993 25200" (Unix timestamp, timezone offset).
     - isodate: Date. Returns the date in ISO 8601 format.
+    - localdate: Date. Converts a date to local date.
     - obfuscate: Any text. Returns the input text rendered as a
           sequence of XML entities.
     - person: Any text. Returns the text before an email address.
--- a/mercurial/templatefilters.py	Fri May 22 08:56:43 2009 +0200
+++ b/mercurial/templatefilters.py	Sun May 24 11:41:07 2009 +0200
@@ -192,6 +192,7 @@
     "isodatesec": lambda x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2'),
     "json": json,
     "jsonescape": jsonescape,
+    "localdate": lambda x: (x[0], util.makedate()[1]),
     "nonempty": nonempty,
     "obfuscate": obfuscate,
     "permissions": permissions,