hledger/hledger-lib/Hledger
Simon Michael 438c4a0469 fix:PeriodData: use Integer keys to avoid date wraparound bugs [#2479]
PeriodData's use of Int keys caused wrong results with periodic
reports involving dates outside the machine-specific limits of Int.
Those were:

64 bits: -25252734927764696-04-22..25252734927768413-06-12
32 bits: -5877752-05-08..5881469-05-27
16 bits:  1769-02-28..1948-08-04
 8 bits:  1858-07-12..1859-03-24

32 bits is supported by MicroHS; 16 and 8 bits aren't supported by
any known haskell version, but that could change in future.

For example, on 64 bit machines we got:

25252734927768413-06-12 PeriodData's max date
   (expenses)   1

25252734927768414-01-01 next year past PeriodData's max date
   (expenses)   2

$ hledger reg -O csv --yearly
"txnidx","date","code","description","account","amount","total"
"0","-25252734927764696-11-10","","","expenses","1","1"

Now it uses Integer (like the time package), fixing the bug.
And benchmarking shows memory and time usage slightly improved
(surprisingly; tested with up to 500 subperiods, eg
hledger -f examples/10ktxns-1kaccts.journal reg -1 cur:A -D >/dev/null)
2025-10-11 11:27:58 -10:00
..
Data fix:PeriodData: use Integer keys to avoid date wraparound bugs [#2479] 2025-10-11 11:27:58 -10:00
Read dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Reports fix:PeriodData: use Integer keys to avoid date wraparound bugs [#2479] 2025-10-11 11:27:58 -10:00
Utils fix: Only escape special characters by single quoting, not escaping *and* quoting 2025-10-09 11:52:37 -10:00
Write dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Data.hs dev!: lib: Refactor splitSpan to return Maybe DayPartition. 2025-10-09 15:31:28 -10:00
Query.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Read.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Reports.hs cln: tests: Remove test and tests, which are just aliases for testCase 2021-08-30 16:32:19 -10:00
Utils.hs dev!: lib: Refactor splitSpan to return Maybe DayPartition. 2025-10-09 15:31:28 -10:00