simonmichael / hledger

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

Abbreviate week naming for weekly reports #2204

Closed victormihalache closed 3 weeks ago

victormihalache commented 3 weeks ago

This PR changes how the week name is displayed in the column header by shortening it for all reports, and omitting the year if all column are within the same year.

We rename showPeriodMonthAbbrev to showPeriodAbbrev as it's now used for weeks too, so not strictly just months.

It adds the following method

showPeriodAbbrev (WeekPeriod b) = T.pack $ formatTime defaultTimeLocale "W%V" b

and changes the multi-year naming:

- showPeriod (WeekPeriod b) = T.pack $ formatTime defaultTimeLocale "%FW%V" b
+ showPeriod (WeekPeriod b) = T.pack $ formatTime defaultTimeLocale "%0Y-W%V" b