Why does areg ignore scondary date, while reg does not?

10 views
Skip to first unread message

Laurenz Wiskott

unread,
Oct 9, 2021, 1:20:57 PM10/9/21
to hledger
Gien the file date2.ledger

2021-01-01 A
    all:account1                                                          100.00 EUR ; date2:2020-02-01
    all:account2


I get the results (with hledger 1.20.99):

linux> hledger -f date2.ledger reg --date2 account1
2020-02-01 A                                all:account1                        100.00 EUR    100.00 EUR

linux> hledger -f date2.ledger areg --date2 account1
Transactions in all:account1 and subaccounts:
2021-01-01 A                                al:account2                         100.00 EUR    100.00 EUR

Why does areg not use date2? Looks like an inconsistency to me.

Simon Michael

unread,
Oct 9, 2021, 1:51:48 PM10/9/21
to hledger
I'd guess it's because areg reports transactions, while reg reports postings. That sounds ok to me.

The situation is unclear though:

1. https://hledger.org/hledger.html#aregister says "Each aregister line item shows: • the transaction's date (or the relevant posting's date if different, see below)"

2. https://hledger.org/hledger.html#aregister-and-custom-posting-dates says "Transactions whose date is outside the report period can still be shown, if they have a posting to this account dated inside the report period. (And in this case it's the posting date that is shown.)"

3. The aregister command contains this comment: "TODO: need to also pass the queries so we can choose which date to render - move them into the report ?"

I'm not seeing the behaviour described by 2. Even if I declare the secondary date on the transaction rather than the posting, --date2 doesn't display it match on it.

So I'd welcome a bug report or PR, changing either the docs or the behaviour, for further testing. There may be some deeper implementation/design/usability reasons, but I don't remember them.


Simon Michael

unread,
Oct 14, 2021, 3:58:12 PM10/14/21
to hle...@googlegroups.com
On Oct 9, 2021, at 7:20 AM, Laurenz Wiskott wrote:
> Why does areg not use date2? Looks like an inconsistency to me.


For the record: this continues at
https://github.com/simonmichael/hledger/issues/1731 .

Reply all
Reply to author
Forward
0 new messages