diff --git a/Ledger/Dates.hs b/Ledger/Dates.hs index 784d00c09..170193217 100644 --- a/Ledger/Dates.hs +++ b/Ledger/Dates.hs @@ -127,7 +127,7 @@ fixSmartDateStr :: Day -> String -> String fixSmartDateStr t s = printf "%04d/%02d/%02d" y m d where (y,m,d) = toGregorian $ fixSmartDate t sdate - sdate = fromparse $ parsewith smartdate $ map toLower s + sdate = fromparse $ parsewith smartdate $ lowercase s -- | Convert a SmartDate to an absolute date using the provided reference date. fixSmartDate :: Day -> SmartDate -> Day @@ -283,8 +283,8 @@ months = ["january","february","march","april","may","june", mons = ["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"] -monthIndex s = maybe 0 (+1) $ (map toLower s) `elemIndex` months -monIndex s = maybe 0 (+1) $ (map toLower s) `elemIndex` mons +monthIndex s = maybe 0 (+1) $ (lowercase s) `elemIndex` months +monIndex s = maybe 0 (+1) $ (lowercase s) `elemIndex` mons month :: Parser SmartDate month = do diff --git a/Ledger/Utils.hs b/Ledger/Utils.hs index 8f09a6723..dedf02cd7 100644 --- a/Ledger/Utils.hs +++ b/Ledger/Utils.hs @@ -42,6 +42,9 @@ import Text.ParserCombinators.Parsec -- strings +lowercase = map toLower +uppercase = map toUpper + strip = dropspaces . reverse . dropspaces . reverse where dropspaces = dropWhile (`elem` " \t")