@@ -127,23 +127,35 @@ 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.
130−-- * @Sun, 01 Feb 2000 13:00:00 UT@ (RSS date format)
130+-- * @Mon, 06 Sep 2010 00:01:00 +0000@
132−-- * @2000-02-01T13:00:00Z@ (Atom date format)
132+-- * @Mon, 06 Sep 2010 00:01:00 UTC@
134−-- * @February 1, 2000 1:00 PM@ (PM is usually uppercase)
134+-- * @Mon, 06 Sep 2010 00:01:00@
136−-- * @February 1, 2000@ (assumes 12:00 AM for the time)
136+-- * @2010-09-06T00:01:00+0000@
138+-- * @2010-09-06T00:01:00Z@
140+-- * @2010-09-06T00:01:00@
142+-- * @2010-09-06 00:01:00+0000@
144+-- * @2010-09-06 00:01:00@
146+-- * @September 06, 2010 00:01 AM@
148+-- Following date-only formats are supported too (@00:00:00@ for time is
153+-- * @September 06, 2010@
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)
140-- and no @published@ metadata field set, this function can render
157-- and no @published@ metadata field set, this function can render
141-- the date.
158-- the date.
143−-- > renderDateField "date" "%B %e, %Y" "Date unknown"
145−-- Will render something like @January 32, 2010@.
147dateField :: String -- ^ Key in which the rendered date should be placed
159dateField :: String -- ^ Key in which the rendered date should be placed
148 -> String -- ^ Format to use on the date
160 -> String -- ^ Format to use on the date
149 -> Context a -- ^ Resulting context
161 -> Context a -- ^ Resulting context
@@ -165,7 +177,7 @@ dateFieldWith locale key format = field key $ \i -> do
166--------------------------------------------------------------------------------
178--------------------------------------------------------------------------------
167-- | Parser to try to extract and parse the time from the @published@
179-- | Parser to try to extract and parse the time from the @published@
168−-- field or from the filename. See 'renderDateField' for more information.
180+-- field or from the filename. See 'dateField' for more information.
169-- Exported for user convenience.
181-- Exported for user convenience.
170getItemUTC :: MonadMetadata m
182getItemUTC :: MonadMetadata m
171 => TimeLocale -- ^ Output time locale
183 => TimeLocale -- ^ Output time locale
@@ -185,9 +197,9 @@ getItemUTC locale id' = do
185 "could not parse time for " ++ show id'
197 "could not parse time for " ++ show id'
186 parseTime' = parseTime locale
198 parseTime' = parseTime locale
187 formats =
199 formats =
188− [ "%a, %d %b %Y %H:%M:%S UT"
200+ [ "%a, %d %b %Y %H:%M:%S %Z"
189− , "%Y-%m-%dT%H:%M:%SZ"
201+ , "%Y-%m-%dT%H:%M:%S%Z"
190− , "%Y-%m-%d %H:%M:%S"
202+ , "%Y-%m-%d %H:%M:%S%Z"
191 , "%Y-%m-%d"
203 , "%Y-%m-%d"
192 , "%B %e, %Y %l:%M %p"
204 , "%B %e, %Y %l:%M %p"
193 , "%B %e, %Y"
205 , "%B %e, %Y"