mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-10 05:39:31 +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
|
fixSmartDateStr t s = printf "%04d/%02d/%02d" y m d
|
||||||
where
|
where
|
||||||
(y,m,d) = toGregorian $ fixSmartDate t sdate
|
(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.
|
-- | Convert a SmartDate to an absolute date using the provided reference date.
|
||||||
fixSmartDate :: Day -> SmartDate -> Day
|
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"]
|
mons = ["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"]
|
||||||
|
|
||||||
monthIndex s = maybe 0 (+1) $ (map toLower s) `elemIndex` months
|
monthIndex s = maybe 0 (+1) $ (lowercase s) `elemIndex` months
|
||||||
monIndex s = maybe 0 (+1) $ (map toLower s) `elemIndex` mons
|
monIndex s = maybe 0 (+1) $ (lowercase s) `elemIndex` mons
|
||||||
|
|
||||||
month :: Parser SmartDate
|
month :: Parser SmartDate
|
||||||
month = do
|
month = do
|
||||||
|
@ -42,6 +42,9 @@ import Text.ParserCombinators.Parsec
|
|||||||
|
|
||||||
-- strings
|
-- strings
|
||||||
|
|
||||||
|
lowercase = map toLower
|
||||||
|
uppercase = map toUpper
|
||||||
|
|
||||||
strip = dropspaces . reverse . dropspaces . reverse
|
strip = dropspaces . reverse . dropspaces . reverse
|
||||||
where dropspaces = dropWhile (`elem` " \t")
|
where dropspaces = dropWhile (`elem` " \t")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user