fix: forecast: Make sure forecast transactions are generated up to the day before the provided query end date. (#1633)

This commit is contained in:
Stephen Morgan 2021-08-03 00:08:15 +10:00 committed by Simon Michael
parent 3dbd441210
commit 1d278993bc
2 changed files with 18 additions and 1 deletions

View File

@ -143,7 +143,7 @@ journalAddForecast CliOpts{inputopts_=iopts, reportspec_=rspec} j =
forecastbeginDefault = dbg2 "forecastbeginDefault" $ fromMaybe today mjournalend
-- "They end on or before the specified report end date, or 180 days from today if unspecified."
mspecifiedend = dbg2 "specifieddates" $ reportPeriodLastDay rspec
mspecifiedend = dbg2 "specifieddates" $ addDays 1 <$> reportPeriodLastDay rspec
forecastendDefault = dbg2 "forecastendDefault" $ fromMaybe (addDays 180 today) mspecifiedend
forecastspan = dbg2 "forecastspan" $

View File

@ -218,3 +218,20 @@ commodity 1,000.00 USD
2020-01-28 (a) 1,000.00 USD 2,000.00 USD
>>>2
>>>=0
# 11. Forecast transactions are generated up to the day before the requested end date
hledger -f - reg -b 2021-01-01 -e 2021-01-05 --forecast
<<<
2021-01-01
(a) 1000
~ daily
(a) 1
>>>
2021-01-01 (a) 1000 1000
2021-01-02 (a) 1 1001
2021-01-03 (a) 1 1002
2021-01-04 (a) 1 1003
>>>2
>>>=0