From 9c1db9ed9f32a341056a5c1492b850f7da8ce77b Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 18 Jun 2018 18:08:55 -0700 Subject: [PATCH] lib: fix forecast start/end dates pushed too soon --- hledger/Hledger/Cli/Utils.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hledger/Hledger/Cli/Utils.hs b/hledger/Hledger/Cli/Utils.hs index 1943f4051..f740347a2 100644 --- a/hledger/Hledger/Cli/Utils.hs +++ b/hledger/Hledger/Cli/Utils.hs @@ -144,12 +144,12 @@ journalAddForecast opts@CliOpts{reportopts_=ropts} j = do today <- getCurrentDay -- "They start on or after the day following the latest normal transaction in the journal, or today if there are none." - let DateSpan mjournalstart _ = journalDateSpan False j -- ignore secondary dates - forecaststart = fromMaybe today mjournalstart + let DateSpan _ mjournalend = dbg2 "journalspan" $ journalDateSpan False j -- ignore secondary dates + forecaststart = dbg2 "forecaststart" $ fromMaybe today mjournalend -- "They end on or before the specified report end date, or 180 days from today if unspecified." - mspecifiedstart <- fst <$> specifiedStartEndDates ropts - let forecastend = fromMaybe (addDays 180 today) mspecifiedstart + mspecifiedend <- snd . dbg2 "specifieddates" <$> specifiedStartEndDates ropts + let forecastend = dbg2 "forecastend" $ fromMaybe (addDays 180 today) mspecifiedend let forecastspan = DateSpan (Just forecaststart) (Just forecastend) forecasttxns = [ txnTieKnot t | pt <- jperiodictxns j