Skip to content

Inconsistent amount formatting in CSV output when using --budget #2555

Description

@profmaad

hledger seems to be inconsistent in how it formats amounts in the CSV output of a budget report, based on whether --budget is passed or not.

hledger version: hledger 1.51.2, linux-x86_64

Sample journal:

commodity EUR 1,000.00

~ monthly
    (Expenses:Example)                    EUR 100000

2026-01-02 Bug report
	Assets:Example  EUR -42000
	Expenses:Example

hledger balance without --budget ignores the commodity formatting directive (I would say correctly):

$ hledger -f bug_report.ledger balance -b 2026-01-01 Expenses -O csv
"account","balance"
"Expenses:Example","EUR 42000.00"
"Total:","EUR 42000.00"

But hledger balance with --budget prints the amounts as per the commodity formatting directive, thus breaking CSV parsing of the output:

$ hledger -f bug_report.ledger balance -b 2026-01-01 Expenses -O csv --budget
"Account","2026-01-01..2026-01-02","budget"
"Expenses:Example","EUR 42,000.00","EUR 100,000.00"
"Total:","EUR 42,000.00","EUR 100,000.00"

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.affects3-fewAffects just a few users.annoyance2-minorMinor to moderate usability/doc bug, reasonably easy to avoid or tolerate.balancebudgetThe balance command's --budget reportcsvThe csv file format, csv output format, or generally CSV-related.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions