on master help sign in
Support timezones as well
commitcacc7a4f1800bc0ad514c5fc08e9dc47b336badb authorSimonas Kazlauskas <git@kazlauskas.me> dateSat 16 Mar 2013, 13:02 (14 years ago) parent0c2b429
1 file changed+24−7
src/Hakyll/Web/Template/Context.hs+24−7
src/Hakyll/Web/Template/Context.hs+24−7
@@ -127,13 +127,30 @@ titleField key = mapContext takeBaseName $ pathField key
127127-- | When the metadata has a field called @published@ in one of the
128128-- following formats then this function can render the date.
129129--
130−-- * @Sun, 01 Feb 2000 13:00:00 UT@ (RSS date format)
130+-- * @Mon, 06 Sep 2010 00:01:00 +0000@
131131--
132−-- * @2000-02-01T13:00:00Z@ (Atom date format)
132+-- * @Mon, 06 Sep 2010 00:01:00 UTC@
133133--
134−-- * @February 1, 2000 1:00 PM@ (PM is usually uppercase)
134+-- * @Mon, 06 Sep 2010 00:01:00@
135135--
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@
137154--
138155-- Alternatively, when the metadata has a field called @path@ in a
139156-- @folder/yyyy-mm-dd-title.extension@ format (the convention for pages)
@@ -180,9 +197,9 @@ getItemUTC locale id' = do
180197 "could not parse time for " ++ show id'
181198 parseTime' = parseTime locale
182199 formats =
183− [ "%a, %d %b %Y %H:%M:%S UT"
184− , "%Y-%m-%dT%H:%M:%SZ"
185− , "%Y-%m-%d %H:%M:%S"
200+ [ "%a, %d %b %Y %H:%M:%S %Z"
201+ , "%Y-%m-%dT%H:%M:%S%Z"
202+ , "%Y-%m-%d %H:%M:%S%Z"
186203 , "%Y-%m-%d"
187204 , "%B %e, %Y %l:%M %p"
188205 , "%B %e, %Y"