on master help sign in
Support timezones as well
cacc7a4Simonas Kazlauskas
src/Hakyll/Web/Template/Context.hs+24−7
@@ -127,13 +127,30 @@ titleField key = mapContext takeBaseName $ pathField key
127-- | When the metadata has a field called @published@ in one of the
127-- | When the metadata has a field called @published@ in one of the
128-- following formats then this function can render the date.
128-- following formats then this function can render the date.
129--
129--
130−-- * @Sun, 01 Feb 2000 13:00:00 UT@ (RSS date format)
130+-- * @Mon, 06 Sep 2010 00:01:00 +0000@
131--
131--
132−-- * @2000-02-01T13:00:00Z@ (Atom date format)
132+-- * @Mon, 06 Sep 2010 00:01:00 UTC@
133--
133--
134−-- * @February 1, 2000 1:00 PM@ (PM is usually uppercase)
134+-- * @Mon, 06 Sep 2010 00:01:00@
135--
135--
136−-- * @February 1, 2000@ (assumes 12:00 AM for the time)
136+-- * @2010-09-06T00:01:00+0000@
137+--
138+-- * @2010-09-06T00:01:00Z@
139+--
140+-- * @2010-09-06T00:01:00@
141+--
142+-- * @2010-09-06 00:01:00+0000@
143+--
144+-- * @2010-09-06 00:01:00@
145+--
146+-- * @September 06, 2010 00:01 AM@
147+--
148+-- Following date-only formats are supported too (@00:00:00@ for time is
149+-- assumed)
150+--
151+-- * @2010-09-06@
152+--
153+-- * @September 06, 2010@
137--
154--
138-- Alternatively, when the metadata has a field called @path@ in a
155-- Alternatively, when the metadata has a field called @path@ in a
139-- @folder/yyyy-mm-dd-title.extension@ format (the convention for pages)
156-- @folder/yyyy-mm-dd-title.extension@ format (the convention for pages)
@@ -180,9 +197,9 @@ getItemUTC locale id' = do
180 "could not parse time for " ++ show id'
197 "could not parse time for " ++ show id'
181 parseTime' = parseTime locale
198 parseTime' = parseTime locale
182 formats =
199 formats =
183− [ "%a, %d %b %Y %H:%M:%S UT"
200+ [ "%a, %d %b %Y %H:%M:%S %Z"
184− , "%Y-%m-%dT%H:%M:%SZ"
201+ , "%Y-%m-%dT%H:%M:%S%Z"
185− , "%Y-%m-%d %H:%M:%S"
202+ , "%Y-%m-%d %H:%M:%S%Z"
186 , "%Y-%m-%d"
203 , "%Y-%m-%d"
187 , "%B %e, %Y %l:%M %p"
204 , "%B %e, %Y %l:%M %p"
188 , "%B %e, %Y"
205 , "%B %e, %Y"