Skip to content

1.19: balance --date2 is not respecting date: #1745

Closed

Description

@simonmichael

From a report by heyarne in chat:

$ 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

Activity

  1. added
    A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.
    queriesFiltering options, query arguments..
    regressionA backwards step, indicating a weakness in our QA. We don't like these.
    on Nov 2, 2021
  2. rrrnld commented on Nov 2, 2021

    @rrrnld

    I'd like to add that querying for date2:2021 works as expected.

  3. simonmichael commented on Nov 2, 2021

    @simonmichael
    MemberAuthor

    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.

  4. Xitian9 commented on Nov 5, 2021

    @Xitian9
    Collaborator

    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.

  5. Xitian9 commented on Nov 5, 2021

    @Xitian9
    Collaborator

    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:

    • balance reports completely ignored secondary dates
    • 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 
    
    
  6. Xitian9 commented on Nov 5, 2021

    @Xitian9
    Collaborator

    It looks like this bug goes at least as far back as 2012.

  7. simonmichael commented on Nov 6, 2021

    @simonmichael
    MemberAuthor

    Thanks!

  8. changed the title [-]balance --date2 is not respecting date: (since 1.19)[/-] [+]1.19: balance --date2 is not respecting date:[/+] on Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.balancebountyThar's some kind o' loot on offer..queriesFiltering options, query arguments..regressionA backwards step, indicating a weakness in our QA. We don't like these.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions