Skip to content

period expressions: support quarterly on a custom day #2437

@simonmichael

Description

@simonmichael

From @zino23 [1]:

hledger support specifying a custom day on a week, month and year, but not on a quarter.

E.g. we can specify a recurring transaction every 1st day of the month:

~ every 1st day of month from 2025-07-31 to 2026-07-30
  expenses:rent  7,875 CNY
  assets:bank:cmb

Output of hl reg expenses:rent --forecast

2025-09-01                                                              expenses:rent                                                  7875.00 CNY   7875.00 CNY
2025-10-01                                                              expenses:rent                                                  7875.00 CNY  15750.00 CNY
2025-11-01                                                              expenses:rent                                                  7875.00 CNY  23625.00 CNY
2025-12-01                                                              expenses:rent                                                  7875.00 CNY  31500.00 CNY
2026-01-01                                                              expenses:rent                                                  7875.00 CNY  39375.00 CNY

But specify every 1st day of the quarter fails:

~ every 1st day of quarter from 2025-07-31 to 2026-07-30
  expenses:rent  7,875 CNY
  assets:bank:cmb

Error output:

    |
161 | ~ every 1st day of quarter from 2025-07-31 to 2026-07-30
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

remainder of period expression cannot be parsed
perhaps you need to terminate the period expression with a double space?
a double space is required between period expression and description/comment

We can only specify a transaction takes place every quarter with this:

~ every quarter from 2025-07-31 to 2026-07-30
  expenses:rent  7,875 CNY
  assets:bank:cmb

and the transaction will take place at the last day of the quarter:

hl reg expenses:rent --forecast
2025-10-31                                                              expenses:rent                                                  7875.00 CNY   7875.00 CNY

But in reality the transaction takes place on 2025-07-31, so assets:bank:cmb's money is incorrect from 2025-07-31 to 2025-10-30, with a deficit of 7875 CNY. After 2025-10-31, it will be corrected.

Is there a good reason specifying a custom day is not supported on quarter?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WISHSome kind of improvement request or proposal.journalThe journal file format, and its features.period-expressionsPeriod expressions, used in queries, periodic rules, etc.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions