Can hledger reports reflect custom budget months?

Hello everyone,
I'm looking for a way to provide a custom date interval to an hledger command.

My use case is the following:
I have a CLI tool helping me decide for every week which "budget month" it is part of (e.g., when a week overlaps two months, it decides which month the week belongs to). I don't like splitting weeks, and this is the solution I've come up with.

Now, I would love to use hledger's reporting capabilities with a monthly query
hledger --no-conf --file ~/path/to/my-journal.journal incomestatement -p 2024 -M
to reflect this. Right now, the expenses will be tied to their respective month.

Is their any way to achieve this?

Let me know if anything is not clear, I'll be happy to provide more details.

Hello,

I guess you want to keep the transaction dates accurate. But I suppose you could record adjusted budgeting dates as https://hledger.org/1.52/hledger.html#secondary-dates, and run your budget reports with --date2 ?

Hi,
Thanks for the prompt reply and many more thanks for the awesome tool that is Hledger!
I'm not sure secondary date is what I'm looking for. From what I understand from the page you linked, secondary date allow to link two dates to a single posting.
My goal is not to keep transaction dates accurate.
My goal is to group budget week in their "correct" budget month.

Let's take 2024 as an example. My tool output a Json dividing a year into budget month as I explained earlier.

  {
    "name": "January",
    "weeks": [
      {
        "start_date": "2024-01-01",
        "end_date": "2024-01-07",
        "start_day": "Mon"
      },
      {
        "start_date": "2024-01-08",
        "end_date": "2024-01-14",
        "start_day": "Mon"
      },
      {
        "start_date": "2024-01-15",
        "end_date": "2024-01-21",
        "start_day": "Mon"
      },
      {
        "start_date": "2024-01-22",
        "end_date": "2024-01-28",
        "start_day": "Mon"
      }
    ]
  },
  {
    "name": "February",
    "weeks": [
      {
        "start_date": "2024-01-29",
        "end_date": "2024-02-04",
        "start_day": "Mon"
      },
      {
...

As you can see, the first week of February starts in January. What I would really want is for Hledger to use this timeframe when doing a query that spans over months (e.g., January runs from 01-01 to 01-28)

Hope that makes it a bit more clear.

Cheers.

I think this implies that you can't or do not want to use '-b' /'-e' with your custom dates. Am I right? If I am - could you elaborate why?

Penalised something like this would work: hledger run with a script that your tool genrated. Script will contain 12 commands, one per "month", with custom begin/end dates, and perhaps with --total-only