git.iko.soy/typeable/pandoc
on master help sign in
Shared: Add further formats for `normalizeDate`

We want to avoid illegal dates -- in particular years with greater than four digits. We attempt to parse series of digits first as `%Y%m%d`, then `%Y%m`, and finally `%Y`.

commit4816facee4d8d157a8436952d106f065742dc121 authorJesse Rosenthal <jrosenthal@jhu.edu> dateSat 9 Jul 2016, 11:13 (10 years ago) parent8248dde
1 file changed+2−1
src/Text/Pandoc/Shared.hs+2−1
src/Text/Pandoc/Shared.hs+2−1
@@ -335,7 +335,8 @@ normalizeDate s = fmap (formatTime defaultTimeLocale "%F")
335335 parseTime defaultTimeLocale
336336#endif
337337 formats = ["%x","%m/%d/%Y", "%D","%F", "%d %b %Y",
338− "%d %B %Y", "%b. %d, %Y", "%B %d, %Y", "%Y"]
338+ "%d %B %Y", "%b. %d, %Y", "%B %d, %Y",
339+ "%Y%m%d", "%Y%m", "%Y"]
339340
340341--
341342-- Pandoc block and inline list processing