;lib: update doctests for ISO 8601 date output

[ci skip]
This commit is contained in:
Simon Michael 2020-02-03 08:03:44 -08:00
parent bd333a344d
commit e0a46a6523
4 changed files with 90 additions and 90 deletions

View File

@ -176,21 +176,21 @@ spansSpan spans = DateSpan (maybe Nothing spanStart $ headMay spans) (maybe Noth
-- >>> t (Months 1) "2008/01/01" "2008/04/01" -- >>> t (Months 1) "2008/01/01" "2008/04/01"
-- [DateSpan 2008/01,DateSpan 2008/02,DateSpan 2008/03] -- [DateSpan 2008/01,DateSpan 2008/02,DateSpan 2008/03]
-- >>> t (Months 2) "2008/01/01" "2008/04/01" -- >>> t (Months 2) "2008/01/01" "2008/04/01"
-- [DateSpan 2008/01/01-2008/02/29,DateSpan 2008/03/01-2008/04/30] -- [DateSpan 2008-01-01-2008-02-29,DateSpan 2008-03-01-2008-04-30]
-- >>> t (Weeks 1) "2008/01/01" "2008/01/15" -- >>> t (Weeks 1) "2008/01/01" "2008/01/15"
-- [DateSpan 2007/12/31w01,DateSpan 2008/01/07w02,DateSpan 2008/01/14w03] -- [DateSpan 2007-12-31w01,DateSpan 2008-01-07w02,DateSpan 2008-01-14w03]
-- >>> t (Weeks 2) "2008/01/01" "2008/01/15" -- >>> t (Weeks 2) "2008/01/01" "2008/01/15"
-- [DateSpan 2007/12/31-2008/01/13,DateSpan 2008/01/14-2008/01/27] -- [DateSpan 2007-12-31-2008-01-13,DateSpan 2008-01-14-2008-01-27]
-- >>> t (DayOfMonth 2) "2008/01/01" "2008/04/01" -- >>> t (DayOfMonth 2) "2008/01/01" "2008/04/01"
-- [DateSpan 2007/12/02-2008/01/01,DateSpan 2008/01/02-2008/02/01,DateSpan 2008/02/02-2008/03/01,DateSpan 2008/03/02-2008/04/01] -- [DateSpan 2007-12-02-2008-01-01,DateSpan 2008-01-02-2008-02-01,DateSpan 2008-02-02-2008-03-01,DateSpan 2008-03-02-2008-04-01]
-- >>> t (WeekdayOfMonth 2 4) "2011/01/01" "2011/02/15" -- >>> t (WeekdayOfMonth 2 4) "2011/01/01" "2011/02/15"
-- [DateSpan 2010/12/09-2011/01/12,DateSpan 2011/01/13-2011/02/09,DateSpan 2011/02/10-2011/03/09] -- [DateSpan 2010-12-09-2011-01-12,DateSpan 2011-01-13-2011-02-09,DateSpan 2011-02-10-2011-03-09]
-- >>> t (DayOfWeek 2) "2011/01/01" "2011/01/15" -- >>> t (DayOfWeek 2) "2011/01/01" "2011/01/15"
-- [DateSpan 2010/12/28-2011/01/03,DateSpan 2011/01/04-2011/01/10,DateSpan 2011/01/11-2011/01/17] -- [DateSpan 2010-12-28-2011-01-03,DateSpan 2011-01-04-2011-01-10,DateSpan 2011-01-11-2011-01-17]
-- >>> t (DayOfYear 11 29) "2011/10/01" "2011/10/15" -- >>> t (DayOfYear 11 29) "2011/10/01" "2011/10/15"
-- [DateSpan 2010/11/29-2011/11/28] -- [DateSpan 2010-11-29-2011-11-28]
-- >>> t (DayOfYear 11 29) "2011/12/01" "2012/12/15" -- >>> t (DayOfYear 11 29) "2011/12/01" "2012/12/15"
-- [DateSpan 2011/11/29-2012/11/28,DateSpan 2012/11/29-2013/11/28] -- [DateSpan 2011-11-29-2012-11-28,DateSpan 2012-11-29-2013-11-28]
-- --
splitSpan :: Interval -> DateSpan -> [DateSpan] splitSpan :: Interval -> DateSpan -> [DateSpan]
splitSpan _ (DateSpan Nothing Nothing) = [DateSpan Nothing Nothing] splitSpan _ (DateSpan Nothing Nothing) = [DateSpan Nothing Nothing]
@ -258,7 +258,7 @@ spansIntersect (d:ds) = d `spanIntersect` (spansIntersect ds)
-- --
-- For non-intersecting spans, gives an empty span beginning on the second's start date: -- For non-intersecting spans, gives an empty span beginning on the second's start date:
-- >>> mkdatespan "2018-01-01" "2018-01-03" `spanIntersect` mkdatespan "2018-01-03" "2018-01-05" -- >>> mkdatespan "2018-01-01" "2018-01-03" `spanIntersect` mkdatespan "2018-01-03" "2018-01-05"
-- DateSpan 2018/01/03-2018/01/02 -- DateSpan 2018-01-03-2018-01-02
spanIntersect (DateSpan b1 e1) (DateSpan b2 e2) = DateSpan b e spanIntersect (DateSpan b1 e1) (DateSpan b2 e2) = DateSpan b e
where where
b = latest b1 b2 b = latest b1 b2
@ -405,72 +405,72 @@ fixSmartDateStrEither' d s = case parsewith smartdateonly (T.toLower s) of
-- >>> :set -XOverloadedStrings -- >>> :set -XOverloadedStrings
-- >>> let t = fixSmartDateStr (parsedate "2008/11/26") -- >>> let t = fixSmartDateStr (parsedate "2008/11/26")
-- >>> t "0000-01-01" -- >>> t "0000-01-01"
-- "0000/01/01" -- "0000-01-01"
-- >>> t "1999-12-02" -- >>> t "1999-12-02"
-- "1999/12/02" -- "1999-12-02"
-- >>> t "1999.12.02" -- >>> t "1999.12.02"
-- "1999/12/02" -- "1999-12-02"
-- >>> t "1999/3/2" -- >>> t "1999/3/2"
-- "1999/03/02" -- "1999-03-02"
-- >>> t "19990302" -- >>> t "19990302"
-- "1999/03/02" -- "1999-03-02"
-- >>> t "2008/2" -- >>> t "2008/2"
-- "2008/02/01" -- "2008-02-01"
-- >>> t "0020/2" -- >>> t "0020/2"
-- "0020/02/01" -- "0020-02-01"
-- >>> t "1000" -- >>> t "1000"
-- "1000/01/01" -- "1000-01-01"
-- >>> t "4/2" -- >>> t "4/2"
-- "2008/04/02" -- "2008-04-02"
-- >>> t "2" -- >>> t "2"
-- "2008/11/02" -- "2008-11-02"
-- >>> t "January" -- >>> t "January"
-- "2008/01/01" -- "2008-01-01"
-- >>> t "feb" -- >>> t "feb"
-- "2008/02/01" -- "2008-02-01"
-- >>> t "today" -- >>> t "today"
-- "2008/11/26" -- "2008-11-26"
-- >>> t "yesterday" -- >>> t "yesterday"
-- "2008/11/25" -- "2008-11-25"
-- >>> t "tomorrow" -- >>> t "tomorrow"
-- "2008/11/27" -- "2008-11-27"
-- >>> t "this day" -- >>> t "this day"
-- "2008/11/26" -- "2008-11-26"
-- >>> t "last day" -- >>> t "last day"
-- "2008/11/25" -- "2008-11-25"
-- >>> t "next day" -- >>> t "next day"
-- "2008/11/27" -- "2008-11-27"
-- >>> t "this week" -- last monday -- >>> t "this week" -- last monday
-- "2008/11/24" -- "2008-11-24"
-- >>> t "last week" -- previous monday -- >>> t "last week" -- previous monday
-- "2008/11/17" -- "2008-11-17"
-- >>> t "next week" -- next monday -- >>> t "next week" -- next monday
-- "2008/12/01" -- "2008-12-01"
-- >>> t "this month" -- >>> t "this month"
-- "2008/11/01" -- "2008-11-01"
-- >>> t "last month" -- >>> t "last month"
-- "2008/10/01" -- "2008-10-01"
-- >>> t "next month" -- >>> t "next month"
-- "2008/12/01" -- "2008-12-01"
-- >>> t "this quarter" -- >>> t "this quarter"
-- "2008/10/01" -- "2008-10-01"
-- >>> t "last quarter" -- >>> t "last quarter"
-- "2008/07/01" -- "2008-07-01"
-- >>> t "next quarter" -- >>> t "next quarter"
-- "2009/01/01" -- "2009-01-01"
-- >>> t "this year" -- >>> t "this year"
-- "2008/01/01" -- "2008-01-01"
-- >>> t "last year" -- >>> t "last year"
-- "2007/01/01" -- "2007-01-01"
-- >>> t "next year" -- >>> t "next year"
-- "2009/01/01" -- "2009-01-01"
-- --
-- t "last wed" -- t "last wed"
-- "2008/11/19" -- "2008-11-19"
-- t "next friday" -- t "next friday"
-- "2008/11/28" -- "2008-11-28"
-- t "next january" -- t "next january"
-- "2009/01/01" -- "2009-01-01"
-- --
fixSmartDate :: Day -> SmartDate -> Day fixSmartDate :: Day -> SmartDate -> Day
fixSmartDate refdate = fix fixSmartDate refdate = fix
@ -910,35 +910,35 @@ lastthisnextthing = do
-- --
-- >>> let p = parsePeriodExpr (parsedate "2008/11/26") -- >>> let p = parsePeriodExpr (parsedate "2008/11/26")
-- >>> p "from Aug to Oct" -- >>> p "from Aug to Oct"
-- Right (NoInterval,DateSpan 2008/08/01-2008/09/30) -- Right (NoInterval,DateSpan 2008-08-01-2008-09-30)
-- >>> p "aug to oct" -- >>> p "aug to oct"
-- Right (NoInterval,DateSpan 2008/08/01-2008/09/30) -- Right (NoInterval,DateSpan 2008-08-01-2008-09-30)
-- >>> p "every 3 days in Aug" -- >>> p "every 3 days in Aug"
-- Right (Days 3,DateSpan 2008/08) -- Right (Days 3,DateSpan 2008/08)
-- >>> p "daily from aug" -- >>> p "daily from aug"
-- Right (Days 1,DateSpan 2008/08/01-) -- Right (Days 1,DateSpan 2008-08-01-)
-- >>> p "every week to 2009" -- >>> p "every week to 2009"
-- Right (Weeks 1,DateSpan -2008/12/31) -- Right (Weeks 1,DateSpan -2008-12-31)
-- >>> p "every 2nd day of month" -- >>> p "every 2nd day of month"
-- Right (DayOfMonth 2,DateSpan -) -- Right (DayOfMonth 2,DateSpan -)
-- >>> p "every 2nd day" -- >>> p "every 2nd day"
-- Right (DayOfMonth 2,DateSpan -) -- Right (DayOfMonth 2,DateSpan -)
-- >>> p "every 2nd day 2009-" -- >>> p "every 2nd day 2009-"
-- Right (DayOfMonth 2,DateSpan 2009/01/01-) -- Right (DayOfMonth 2,DateSpan 2009-01-01-)
-- >>> p "every 29th Nov" -- >>> p "every 29th Nov"
-- Right (DayOfYear 11 29,DateSpan -) -- Right (DayOfYear 11 29,DateSpan -)
-- >>> p "every 29th nov -2009" -- >>> p "every 29th nov -2009"
-- Right (DayOfYear 11 29,DateSpan -2008/12/31) -- Right (DayOfYear 11 29,DateSpan -2008-12-31)
-- >>> p "every nov 29th" -- >>> p "every nov 29th"
-- Right (DayOfYear 11 29,DateSpan -) -- Right (DayOfYear 11 29,DateSpan -)
-- >>> p "every Nov 29th 2009-" -- >>> p "every Nov 29th 2009-"
-- Right (DayOfYear 11 29,DateSpan 2009/01/01-) -- Right (DayOfYear 11 29,DateSpan 2009-01-01-)
-- >>> p "every 11/29 from 2009" -- >>> p "every 11/29 from 2009"
-- Right (DayOfYear 11 29,DateSpan 2009/01/01-) -- Right (DayOfYear 11 29,DateSpan 2009-01-01-)
-- >>> p "every 2nd Thursday of month to 2009" -- >>> p "every 2nd Thursday of month to 2009"
-- Right (WeekdayOfMonth 2 4,DateSpan -2008/12/31) -- Right (WeekdayOfMonth 2 4,DateSpan -2008-12-31)
-- >>> p "every 1st monday of month to 2009" -- >>> p "every 1st monday of month to 2009"
-- Right (WeekdayOfMonth 1 1,DateSpan -2008/12/31) -- Right (WeekdayOfMonth 1 1,DateSpan -2008-12-31)
-- >>> p "every tue" -- >>> p "every tue"
-- Right (DayOfWeek 2,DateSpan -) -- Right (DayOfWeek 2,DateSpan -)
-- >>> p "every 2nd day of week" -- >>> p "every 2nd day of week"
@ -948,9 +948,9 @@ lastthisnextthing = do
-- >>> p "every 2nd day" -- >>> p "every 2nd day"
-- Right (DayOfMonth 2,DateSpan -) -- Right (DayOfMonth 2,DateSpan -)
-- >>> p "every 2nd day 2009-" -- >>> p "every 2nd day 2009-"
-- Right (DayOfMonth 2,DateSpan 2009/01/01-) -- Right (DayOfMonth 2,DateSpan 2009-01-01-)
-- >>> p "every 2nd day of month 2009-" -- >>> p "every 2nd day of month 2009-"
-- Right (DayOfMonth 2,DateSpan 2009/01/01-) -- Right (DayOfMonth 2,DateSpan 2009-01-01-)
periodexprp :: Day -> TextParser m (Interval, DateSpan) periodexprp :: Day -> TextParser m (Interval, DateSpan)
periodexprp rdate = do periodexprp rdate = do
skipMany spacenonewline skipMany spacenonewline
@ -1062,7 +1062,7 @@ periodexprdatespanp rdate = choice $ map try [
-- | -- |
-- -- >>> parsewith (doubledatespan (parsedate "2018/01/01") <* eof) "20180101-201804" -- -- >>> parsewith (doubledatespan (parsedate "2018/01/01") <* eof) "20180101-201804"
-- Right DateSpan 2018/01/01-2018/04/01 -- Right DateSpan 2018-01-01-2018-04-01
doubledatespanp :: Day -> TextParser m DateSpan doubledatespanp :: Day -> TextParser m DateSpan
doubledatespanp rdate = do doubledatespanp rdate = do
optional (string' "from" >> skipMany spacenonewline) optional (string' "from" >> skipMany spacenonewline)

View File

@ -170,8 +170,7 @@ instance FromJSON (DecimalRaw Integer)
-- Utilities -- Utilities
-- | Read a json from a file and decode/parse it as the target type, if we can. -- | Read a json from a file and decode/parse it as the target type, if we can.
-- Example: -- Example: >>> readJsonFile "in.json" :: IO MixedAmount
-- >>> readJsonFile "in.json" :: IO MixedAmount
readJsonFile :: FromJSON a => FilePath -> IO a readJsonFile :: FromJSON a => FilePath -> IO a
readJsonFile f = do readJsonFile f = do
bs <- BL.readFile f bs <- BL.readFile f
@ -181,7 +180,6 @@ readJsonFile f = do
Success t -> return t Success t -> return t
-- | Write some to-JSON-convertible haskell value to a json file, if we can. -- | Write some to-JSON-convertible haskell value to a json file, if we can.
-- Example: -- Example: >>> writeJsonFile "out.json" nullmixedamt
-- >>> writeJsonFile "out.json" nullmixedamt
writeJsonFile :: ToJSON a => FilePath -> a -> IO () writeJsonFile :: ToJSON a => FilePath -> a -> IO ()
writeJsonFile f v = BL.writeFile f (encode v) writeJsonFile f v = BL.writeFile f (encode v)

View File

@ -86,107 +86,107 @@ instance Show PeriodicTransaction where
-- - a hidden _generated-transaction: tag which does not appear in the comment. -- - a hidden _generated-transaction: tag which does not appear in the comment.
-- --
-- >>> _ptgen "monthly from 2017/1 to 2017/4" -- >>> _ptgen "monthly from 2017/1 to 2017/4"
-- 2017/01/01 -- 2017-01-01
-- ; generated-transaction: ~ monthly from 2017/1 to 2017/4 -- ; generated-transaction: ~ monthly from 2017/1 to 2017/4
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/02/01 -- 2017-02-01
-- ; generated-transaction: ~ monthly from 2017/1 to 2017/4 -- ; generated-transaction: ~ monthly from 2017/1 to 2017/4
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/03/01 -- 2017-03-01
-- ; generated-transaction: ~ monthly from 2017/1 to 2017/4 -- ; generated-transaction: ~ monthly from 2017/1 to 2017/4
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- --
-- >>> _ptgen "monthly from 2017/1 to 2017/5" -- >>> _ptgen "monthly from 2017/1 to 2017/5"
-- 2017/01/01 -- 2017-01-01
-- ; generated-transaction: ~ monthly from 2017/1 to 2017/5 -- ; generated-transaction: ~ monthly from 2017/1 to 2017/5
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/02/01 -- 2017-02-01
-- ; generated-transaction: ~ monthly from 2017/1 to 2017/5 -- ; generated-transaction: ~ monthly from 2017/1 to 2017/5
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/03/01 -- 2017-03-01
-- ; generated-transaction: ~ monthly from 2017/1 to 2017/5 -- ; generated-transaction: ~ monthly from 2017/1 to 2017/5
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/04/01 -- 2017-04-01
-- ; generated-transaction: ~ monthly from 2017/1 to 2017/5 -- ; generated-transaction: ~ monthly from 2017/1 to 2017/5
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- --
-- >>> _ptgen "every 2nd day of month from 2017/02 to 2017/04" -- >>> _ptgen "every 2nd day of month from 2017/02 to 2017/04"
-- 2017/01/02 -- 2017-01-02
-- ; generated-transaction: ~ every 2nd day of month from 2017/02 to 2017/04 -- ; generated-transaction: ~ every 2nd day of month from 2017/02 to 2017/04
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/02/02 -- 2017-02-02
-- ; generated-transaction: ~ every 2nd day of month from 2017/02 to 2017/04 -- ; generated-transaction: ~ every 2nd day of month from 2017/02 to 2017/04
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/03/02 -- 2017-03-02
-- ; generated-transaction: ~ every 2nd day of month from 2017/02 to 2017/04 -- ; generated-transaction: ~ every 2nd day of month from 2017/02 to 2017/04
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- --
-- >>> _ptgen "every 30th day of month from 2017/1 to 2017/5" -- >>> _ptgen "every 30th day of month from 2017/1 to 2017/5"
-- 2016/12/30 -- 2016-12-30
-- ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5 -- ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/01/30 -- 2017-01-30
-- ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5 -- ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/02/28 -- 2017-02-28
-- ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5 -- ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/03/30 -- 2017-03-30
-- ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5 -- ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/04/30 -- 2017-04-30
-- ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5 -- ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- --
-- >>> _ptgen "every 2nd Thursday of month from 2017/1 to 2017/4" -- >>> _ptgen "every 2nd Thursday of month from 2017/1 to 2017/4"
-- 2016/12/08 -- 2016-12-08
-- ; generated-transaction: ~ every 2nd Thursday of month from 2017/1 to 2017/4 -- ; generated-transaction: ~ every 2nd Thursday of month from 2017/1 to 2017/4
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/01/12 -- 2017-01-12
-- ; generated-transaction: ~ every 2nd Thursday of month from 2017/1 to 2017/4 -- ; generated-transaction: ~ every 2nd Thursday of month from 2017/1 to 2017/4
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/02/09 -- 2017-02-09
-- ; generated-transaction: ~ every 2nd Thursday of month from 2017/1 to 2017/4 -- ; generated-transaction: ~ every 2nd Thursday of month from 2017/1 to 2017/4
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/03/09 -- 2017-03-09
-- ; generated-transaction: ~ every 2nd Thursday of month from 2017/1 to 2017/4 -- ; generated-transaction: ~ every 2nd Thursday of month from 2017/1 to 2017/4
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- --
-- >>> _ptgen "every nov 29th from 2017 to 2019" -- >>> _ptgen "every nov 29th from 2017 to 2019"
-- 2016/11/29 -- 2016-11-29
-- ; generated-transaction: ~ every nov 29th from 2017 to 2019 -- ; generated-transaction: ~ every nov 29th from 2017 to 2019
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2017/11/29 -- 2017-11-29
-- ; generated-transaction: ~ every nov 29th from 2017 to 2019 -- ; generated-transaction: ~ every nov 29th from 2017 to 2019
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2018/11/29 -- 2018-11-29
-- ; generated-transaction: ~ every nov 29th from 2017 to 2019 -- ; generated-transaction: ~ every nov 29th from 2017 to 2019
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- --
-- >>> _ptgen "2017/1" -- >>> _ptgen "2017/1"
-- 2017/01/01 -- 2017-01-01
-- ; generated-transaction: ~ 2017/1 -- ; generated-transaction: ~ 2017/1
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
@ -213,21 +213,21 @@ instance Show PeriodicTransaction where
-- >>> _ptgenspan "every 3 months from 2019-05" (mkdatespan "2020-01-01" "2020-02-01") -- >>> _ptgenspan "every 3 months from 2019-05" (mkdatespan "2020-01-01" "2020-02-01")
-- --
-- >>> _ptgenspan "every 3 months from 2019-05" (mkdatespan "2020-02-01" "2020-03-01") -- >>> _ptgenspan "every 3 months from 2019-05" (mkdatespan "2020-02-01" "2020-03-01")
-- 2020/02/01 -- 2020-02-01
-- ; generated-transaction: ~ every 3 months from 2019-05 -- ; generated-transaction: ~ every 3 months from 2019-05
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- >>> _ptgenspan "every 3 days from 2018" (mkdatespan "2018-01-01" "2018-01-05") -- >>> _ptgenspan "every 3 days from 2018" (mkdatespan "2018-01-01" "2018-01-05")
-- 2018/01/01 -- 2018-01-01
-- ; generated-transaction: ~ every 3 days from 2018 -- ; generated-transaction: ~ every 3 days from 2018
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- 2018/01/04 -- 2018-01-04
-- ; generated-transaction: ~ every 3 days from 2018 -- ; generated-transaction: ~ every 3 days from 2018
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- >>> _ptgenspan "every 3 days from 2018" (mkdatespan "2018-01-02" "2018-01-05") -- >>> _ptgenspan "every 3 days from 2018" (mkdatespan "2018-01-02" "2018-01-05")
-- 2018/01/04 -- 2018-01-04
-- ; generated-transaction: ~ every 3 days from 2018 -- ; generated-transaction: ~ every 3 days from 2018
-- a $1.00 -- a $1.00
-- <BLANKLINE> -- <BLANKLINE>

View File

@ -55,16 +55,16 @@ modifyTransactions tmods = map applymods
-- way (ie, 'txnTieKnot' is called). -- way (ie, 'txnTieKnot' is called).
-- --
-- >>> putStr $ showTransaction $ transactionModifierToFunction (TransactionModifier "" ["pong" `post` usd 2]) nulltransaction{tpostings=["ping" `post` usd 1]} -- >>> putStr $ showTransaction $ transactionModifierToFunction (TransactionModifier "" ["pong" `post` usd 2]) nulltransaction{tpostings=["ping" `post` usd 1]}
-- 0000/01/01 -- 0000-01-01
-- ping $1.00 -- ping $1.00
-- pong $2.00 ; generated-posting: = -- pong $2.00 ; generated-posting: =
-- <BLANKLINE> -- <BLANKLINE>
-- >>> putStr $ showTransaction $ transactionModifierToFunction (TransactionModifier "miss" ["pong" `post` usd 2]) nulltransaction{tpostings=["ping" `post` usd 1]} -- >>> putStr $ showTransaction $ transactionModifierToFunction (TransactionModifier "miss" ["pong" `post` usd 2]) nulltransaction{tpostings=["ping" `post` usd 1]}
-- 0000/01/01 -- 0000-01-01
-- ping $1.00 -- ping $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- >>> putStr $ showTransaction $ transactionModifierToFunction (TransactionModifier "ping" ["pong" `post` amount{aismultiplier=True, aquantity=3}]) nulltransaction{tpostings=["ping" `post` usd 2]} -- >>> putStr $ showTransaction $ transactionModifierToFunction (TransactionModifier "ping" ["pong" `post` amount{aismultiplier=True, aquantity=3}]) nulltransaction{tpostings=["ping" `post` usd 2]}
-- 0000/01/01 -- 0000-01-01
-- ping $2.00 -- ping $2.00
-- pong $6.00 ; generated-posting: = ping -- pong $6.00 ; generated-posting: = ping
-- <BLANKLINE> -- <BLANKLINE>
@ -88,7 +88,9 @@ transactionModifierToFunction mt =
-- >>> tmParseQuery (TransactionModifier "date:2016" []) undefined -- >>> tmParseQuery (TransactionModifier "date:2016" []) undefined
-- Date (DateSpan 2016) -- Date (DateSpan 2016)
-- >>> tmParseQuery (TransactionModifier "date:today" []) (read "2017-01-01") -- >>> tmParseQuery (TransactionModifier "date:today" []) (read "2017-01-01")
-- Date (DateSpan 2017/01/01) -- Date (DateSpan 2017-01-01)
-- >>> tmParseQuery (TransactionModifier "date:today" []) (read "2017-01-01")
-- Date (DateSpan 2017-01-01)
tmParseQuery :: TransactionModifier -> (Day -> Query) tmParseQuery :: TransactionModifier -> (Day -> Query)
tmParseQuery mt = fst . flip parseQuery (tmquerytxt mt) tmParseQuery mt = fst . flip parseQuery (tmquerytxt mt)