##// END OF EJS Templates
keyword: declare input type of date filters as date...
Yuya Nishihara -
r37245:a0b17f74 default
parent child Browse files
Show More
@@ -109,6 +109,7 b' from mercurial import ('
109 109 registrar,
110 110 scmutil,
111 111 templatefilters,
112 templateutil,
112 113 util,
113 114 )
114 115 from mercurial.utils import (
@@ -156,27 +157,27 b" configitem('keywordset', 'svn',"
156 157 default=False,
157 158 )
158 159 # date like in cvs' $Date
159 @templatefilter('utcdate')
160 def utcdate(text):
160 @templatefilter('utcdate', intype=templateutil.date)
161 def utcdate(date):
161 162 '''Date. Returns a UTC-date in this format: "2009/08/18 11:00:13".
162 163 '''
163 164 dateformat = '%Y/%m/%d %H:%M:%S'
164 return dateutil.datestr((dateutil.parsedate(text)[0], 0), dateformat)
165 return dateutil.datestr((date[0], 0), dateformat)
165 166 # date like in svn's $Date
166 @templatefilter('svnisodate')
167 def svnisodate(text):
167 @templatefilter('svnisodate', intype=templateutil.date)
168 def svnisodate(date):
168 169 '''Date. Returns a date in this format: "2009-08-18 13:00:13
169 170 +0200 (Tue, 18 Aug 2009)".
170 171 '''
171 return dateutil.datestr(text, '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)')
172 return dateutil.datestr(date, '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)')
172 173 # date like in svn's $Id
173 @templatefilter('svnutcdate')
174 def svnutcdate(text):
174 @templatefilter('svnutcdate', intype=templateutil.date)
175 def svnutcdate(date):
175 176 '''Date. Returns a UTC-date in this format: "2009-08-18
176 177 11:00:13Z".
177 178 '''
178 179 dateformat = '%Y-%m-%d %H:%M:%SZ'
179 return dateutil.datestr((dateutil.parsedate(text)[0], 0), dateformat)
180 return dateutil.datestr((date[0], 0), dateformat)
180 181
181 182 # make keyword tools accessible
182 183 kwtools = {'hgcmd': ''}
General Comments 0
You need to be logged in to leave comments. Login now