mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-20 02:37:12 +03:00
lowercase/uppercase
This commit is contained in:
parent
0c4cf88578
commit
77098fec7e
@ -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
|
||||
|
@ -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")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user