You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
1.19: balance --date2 is not respecting date: #1745
$ cat a.j
2020-12-31
(a) 1
$ hledger-1.23 -f a.j bal date:2021 # date: correctly excludes the 2020 posting
--------------------
0
$ hledger-1.23 -f a.j bal date:2021 --date2 # but not with --date2
1 a
--------------------
1
$ hledger-1.19 -f a.j bal date:2021 --date2
1 a
--------------------
1
$ hledger-1.18 -f a.j bal date:2021 --date2 # it last worked in 1.18
--------------------
0
I think it's a bug still, because: --date2 should make any secondary dates (there aren't any here) be treated as the primary dates, and then date: should filter those as usual.
Oh, very interesting. It looks like it's not as simple as this working in hledger-1.18 and being broken in hledger-1.19. In fact, this was broken even in hledger-1.18 for multibalance reports.
$ hledger-1.18 -f a.j bal date:2021 --date2 -Y
Balance changes in 2020:
|| 2020
===++======
a || 1
---++------
|| 1
This ‘broke’ in e079c8b, where we deleted all the special balanceReport code and just replaced it with a call to multiBalanceReport.
multibalance reports seemed to take secondary dates into account, but then didn't restrict the dates appropriately
e079c8b then consolidated them into one incorrect implementation: the second.
$ cat a.j
2020-12-31=2021-01-01 Primary date in 2020, secondary date in 2021
(a) 1
2020-12-31 Primary date in 2020, no secondary date
(a) 2
$ hledger-1.18 -f a.j bal date:2021 --date2
--------------------
0
$ hledger-1.18 -f a.j bal date:2021 --date2 -Y
Balance changes in 2020-01-01..2021-12-31:
|| 2020 2021
===++============
a || 2 1
---++------------
|| 2 1
whereas what I would expect would be:
$ hledger-1.18 -f a.j bal date:2021 --date2
1 a
--------------------
1
$ hledger-1.18 -f a.j bal date:2021 --date2 -Y
Balance changes in 2021:
|| 2021
===++======
a || 1
---++------
|| 1
Activity
rrrnld commentedon Nov 2, 2021
I'd like to add that querying for
date2:2021works as expected.simonmichael commentedon Nov 2, 2021
I think it's a bug still, because: --date2 should make any secondary dates (there aren't any here) be treated as the primary dates, and then date: should filter those as usual.
Xitian9 commentedon Nov 5, 2021
Oh, very interesting. It looks like it's not as simple as this working in hledger-1.18 and being broken in hledger-1.19. In fact, this was broken even in hledger-1.18 for multibalance reports.
This ‘broke’ in e079c8b, where we deleted all the special
balanceReportcode and just replaced it with a call tomultiBalanceReport.Xitian9 commentedon Nov 5, 2021
Actually, I'm not sure there was any regression here at all. What we had in hledger-1.18 were two separate incorrect implementations, namely:
e079c8b then consolidated them into one incorrect implementation: the second.
whereas what I would expect would be:
fix: Balance reports should consider date: queries when calculating
fix: balance: Balance reports should consider date: queries when calc…
Xitian9 commentedon Nov 5, 2021
It looks like this bug goes at least as far back as 2012.
fix: balance: Balance reports should consider date: queries when calc…
simonmichael commentedon Nov 6, 2021
Thanks!
[-]balance --date2 is not respecting date: (since 1.19)[/-][+]1.19: balance --date2 is not respecting date:[/+]