simonmichael / hledger

Robust, fast, intuitive plain text accounting tool with CLI, TUI and web interfaces.
https://hledger.org
GNU General Public License v3.0
3.05k stars 320 forks source link

query for all transaction made on date:Xxxdays #1916

Open kiil opened 2 years ago

kiil commented 2 years ago

As far as I can tell, there is currently no way to filter for all transactions made on, for example, mondays.

Something like

hledger reg date:'every monday in june'

or

hledger print date:'every monday in june'

to get a register of all transactions made on any monday in june, or to print them.

Or even

hledger bal date:'every monday in june'

To see how my balance would look like if I only made purchases on mondays.

every monday could perhaps also be shortened `mondays'.

Could also be something like

every weekday in june

and

every weekendday in june

to filter out spending on either weekends or weekdays.

And perhaps

'last weekday in every month'

to see if spending is bigger on paydays. (and to find salary payouts)

The use cases:

Discover spending patterns.

Find transactions you know was made on a particular weekday, but you don't remember which.

Quickly find salaries (for every month).

simonmichael commented 2 years ago

https://hledger.org/1.26/hledger.html#query-types says date:'s argument is a period expression with no report interval. I think you are proposing to allow report intervals there. Related: https://hledger.org/1.26/hledger.html#periods-or-dates- .

Given current period expressions (https://hledger.org/1.26/hledger.html#period-expressions-with-a-report-interval) I think these could describe either a single day, all weekdays, or all weekenddays within each recurring period. If period expressions/report intervals get more expressive in future, date: would also.

kiil commented 2 years ago

So would it be better with another flag than -p for this?

A flag where "every monday" actually means "every monday" - like it does when using forecasting or budgeting with ~.

kiil commented 2 years ago

I might add that this functionality would also be useful for time budgets.

To compare how I spend my time on weekdays vs weekenddays (hopefully different)