diff --git a/hledger-lib/Hledger/Data/Dates.hs b/hledger-lib/Hledger/Data/Dates.hs index 32ead08a4..5f43af02c 100644 --- a/hledger-lib/Hledger/Data/Dates.hs +++ b/hledger-lib/Hledger/Data/Dates.hs @@ -50,6 +50,12 @@ getCurrentDay = do t <- getZonedTime return $ localDay (zonedTimeToLocalTime t) +-- | Get the current local month number. +getCurrentMonth :: IO Int +getCurrentMonth = do + (_,m,_) <- toGregorian `fmap` getCurrentDay + return m + -- | Get the current local year. getCurrentYear :: IO Integer getCurrentYear = do diff --git a/hledger-lib/Hledger/Data/Ledger.hs b/hledger-lib/Hledger/Data/Ledger.hs index 212fce8f0..b000b0449 100644 --- a/hledger-lib/Hledger/Data/Ledger.hs +++ b/hledger-lib/Hledger/Data/Ledger.hs @@ -71,6 +71,10 @@ ledgerAccounts = drop 1 . flatten . ledgerAccountTree 9999 ledgerTopAccounts :: Ledger -> [Account] ledgerTopAccounts = map root . branches . ledgerAccountTree 9999 +-- | List a ledger's bottom-level (subaccount-less) accounts, in tree order +ledgerLeafAccounts :: Ledger -> [Account] +ledgerLeafAccounts = leaves . ledgerAccountTree 9999 + -- | Accounts in ledger whose name matches the pattern, in tree order. ledgerAccountsMatching :: [String] -> Ledger -> [Account] ledgerAccountsMatching pats = filter (matchpats pats . aname) . accounts diff --git a/hledger-lib/Hledger/Reports.hs b/hledger-lib/Hledger/Reports.hs index 99b174562..e60c57a9d 100644 --- a/hledger-lib/Hledger/Reports.hs +++ b/hledger-lib/Hledger/Reports.hs @@ -42,6 +42,7 @@ module Hledger.Reports ( AccountsReportItem, accountsReport, accountsReport2, + isInteresting, -- * Tests tests_Hledger_Reports )