From 007b9f8caaf699852511634752a7d7c86f6adc67 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 30 Jul 2018 11:06:40 +0100 Subject: [PATCH] lib: capitalised month names broke some period expressions (fix #852) This was a regression in hledger 1.10. mon[th]Index are now case insensitive. --- hledger-lib/Hledger/Data/Dates.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hledger-lib/Hledger/Data/Dates.hs b/hledger-lib/Hledger/Data/Dates.hs index 9b3bf1b87..0e5334348 100644 --- a/hledger-lib/Hledger/Data/Dates.hs +++ b/hledger-lib/Hledger/Data/Dates.hs @@ -844,8 +844,11 @@ monthabbrevs = ["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","n weekdays = ["monday","tuesday","wednesday","thursday","friday","saturday","sunday"] weekdayabbrevs = ["mon","tue","wed","thu","fri","sat","sun"] -monthIndex t = maybe 0 (+1) $ t `elemIndex` months -monIndex t = maybe 0 (+1) $ t `elemIndex` monthabbrevs +-- | Convert a case insensitive english month name to a month number. +monthIndex name = maybe 0 (+1) $ T.toLower name `elemIndex` months + +-- | Convert a case insensitive english three-letter month abbreviation to a month number. +monIndex name = maybe 0 (+1) $ T.toLower name `elemIndex` monthabbrevs month :: TextParser m SmartDate month = do