diff mercurial/util.py @ 6134:7b937b26adf7

Make annotae/grep print short dates with -q/--quiet. Move shortdate() from templatefilters to util to avoid code duplication.
author Thomas Arendsen Hein <thomas@intevation.de>
date Sat, 16 Feb 2008 13:33:38 +0100
parents 213ea6eed412
children be91a77b7f18
line wrap: on
line diff
--- a/mercurial/util.py	Sat Feb 16 13:01:27 2008 +0100
+++ b/mercurial/util.py	Sat Feb 16 13:33:38 2008 +0100
@@ -1533,6 +1533,10 @@
         s += timezone_format % (-tz / 3600, ((-tz % 3600) / 60))
     return s
 
+def shortdate(date=None):
+    """turn (timestamp, tzoff) tuple into iso 8631 date."""
+    return datestr(date, format='%Y-%m-%d', timezone=False)
+
 def strdate(string, format, defaults=[]):
     """parse a localized time string and return a (unixtime, offset) tuple.
     if the string cannot be parsed, ValueError is raised."""