From 4816facee4d8d157a8436952d106f065742dc121 Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal Date: Sat, 9 Jul 2016 11:13:25 -0400 Subject: 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`. --- src/Text/Pandoc/Shared.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 9c6c4b33f..af56c6654 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -335,7 +335,8 @@ normalizeDate s = fmap (formatTime defaultTimeLocale "%F") parseTime defaultTimeLocale #endif formats = ["%x","%m/%d/%Y", "%D","%F", "%d %b %Y", - "%d %B %Y", "%b. %d, %Y", "%B %d, %Y", "%Y"] + "%d %B %Y", "%b. %d, %Y", "%B %d, %Y", + "%Y%m%d", "%Y%m", "%Y"] -- -- Pandoc block and inline list processing -- cgit v1.2.3