aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2016-07-09 11:13:25 -0400
committerJesse Rosenthal <jrosenthal@jhu.edu>2016-07-14 17:02:30 -0400
commit4816facee4d8d157a8436952d106f065742dc121 (patch)
tree85371024cb70e56f79586041ebc2120784fe28ed
parent8248dde2b70c3132ae9b75d01a04738ad9991f47 (diff)
downloadpandoc-4816facee4d8d157a8436952d106f065742dc121.tar.gz
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`.
-rw-r--r--src/Text/Pandoc/Shared.hs3
1 files changed, 2 insertions, 1 deletions
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