From 70ef3e816cd4ef4dbd2c7c6aa54322c3556b814f Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 16 Mar 2023 14:52:37 -1000 Subject: [PATCH] fix: stats: fix a regression in date display since 1.28 (#2012) --- hledger/Hledger/Cli/Commands/Stats.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hledger/Hledger/Cli/Commands/Stats.hs b/hledger/Hledger/Cli/Commands/Stats.hs index 3bdca1d7c..09e73672a 100644 --- a/hledger/Hledger/Cli/Commands/Stats.hs +++ b/hledger/Hledger/Cli/Commands/Stats.hs @@ -70,7 +70,7 @@ showLedgerStats l today spn = (stts, tnum) = ([ ("Main file", path) -- ++ " (from " ++ source ++ ")") ,("Included files", unlines $ drop 1 $ journalFilePaths j) - ,("Transactions span", printf "%s to %s (%d days)" (start spn) (end spn) days) + ,("Transactions span", printf "%s to %s (%d days)" (showstart spn) (showend spn) days) ,("Last transaction", maybe "none" show lastdate ++ showelapsed lastelapsed) ,("Transactions", printf "%d (%0.1f per day)" tnum txnrate) ,("Transactions last 30 days", printf "%d (%0.1f per day)" tnum30 txnrate30) @@ -100,10 +100,10 @@ showLedgerStats l today spn = direction | dys >= 0 = "days ago" :: String | otherwise = "days from now" tnum1 = length ts -- Integer would be better - start (DateSpan (Just d) _) = show d - start _ = "" - end (DateSpan _ (Just d)) = show d - end _ = "" + showstart (DateSpan (Just efd) _) = show $ fromEFDay efd + showstart _ = "" + showend (DateSpan _ (Just efd)) = show $ fromEFDay efd + showend _ = "" days = fromMaybe 0 $ daysInSpan spn txnrate | days==0 = 0 | otherwise = fromIntegral tnum1 / fromIntegral days :: Double