diff --git a/hledger/Hledger/Cli/Commands/Activity.hs b/hledger/Hledger/Cli/Commands/Activity.hs index f48beaa48..515131041 100644 --- a/hledger/Hledger/Cli/Commands/Activity.hs +++ b/hledger/Hledger/Cli/Commands/Activity.hs @@ -43,7 +43,7 @@ showHistogram rspec@ReportSpec{_rsQuery=q} j = -- ps = sortBy (comparing postingDate) $ filterempties $ filter matchapats $ filterdepth $ journalPostings j ps = sortOn postingDate $ filter (q `matchesPosting`) $ journalPostings j -printDayWith f (DateSpan (Just b) _, ps) = printf "%s %s\n" (show b) (f ps) +printDayWith f (DateSpan (Just b) _, ps) = printf "%s %s\n" (show $ fromEFDay b) (f ps) printDayWith _ _ = error "Expected start date for DateSpan" -- PARTIAL: countBar ps = replicate (length ps) barchar diff --git a/hledger/test/activity.test b/hledger/test/activity.test new file mode 100644 index 000000000..c2fe23b9d --- /dev/null +++ b/hledger/test/activity.test @@ -0,0 +1,38 @@ +# 1. activity report is daily by default. +< +2023-01-01 + (a) 1 + +2023-01-06 + (a) 1 + +$ hledger -f - activity +2023-01-01 * +2023-01-02 +2023-01-03 +2023-01-04 +2023-01-05 +2023-01-06 * + +# 2. A weekly activity report. +< +2023-01-01 + (a) 1 + +2023-01-06 + (a) 1 + +$ hledger -f - activity -W +2022-12-26 * +2023-01-02 * + +# 2. A 7-day activity report starting on an date. +< +2023-01-01 + (a) 1 + +2023-01-06 + (a) 1 + +$ hledger -f - activity -W -b2023-01-01 +2023-01-01 **