mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-28 12:54:07 +03:00
lib: clarify journalEndDate, add journalLastDay
This commit is contained in:
parent
7f2ad64e7b
commit
5d2caf3c7f
@ -60,6 +60,7 @@ module Hledger.Data.Journal (
|
||||
journalDateSpanBothDates,
|
||||
journalStartDate,
|
||||
journalEndDate,
|
||||
journalLastDay,
|
||||
journalDescriptions,
|
||||
journalFilePath,
|
||||
journalFilePaths,
|
||||
@ -1316,11 +1317,16 @@ journalDateSpanHelper whichdate j =
|
||||
journalStartDate :: Bool -> Journal -> Maybe Day
|
||||
journalStartDate secondary j = b where DateSpan b _ = journalDateSpan secondary j
|
||||
|
||||
-- | The latest of this journal's transaction and posting dates, or
|
||||
-- Nothing if there are none.
|
||||
-- | The "exclusive end date" of this journal: the day following its latest transaction
|
||||
-- or posting date, or Nothing if there are none.
|
||||
journalEndDate :: Bool -> Journal -> Maybe Day
|
||||
journalEndDate secondary j = e where DateSpan _ e = journalDateSpan secondary j
|
||||
|
||||
-- | The latest of this journal's transaction and posting dates, or
|
||||
-- Nothing if there are none.
|
||||
journalLastDay :: Bool -> Journal -> Maybe Day
|
||||
journalLastDay secondary j = addDays (-1) <$> journalEndDate secondary j
|
||||
|
||||
-- | Apply the pivot transformation to all postings in a journal,
|
||||
-- replacing their account name by their value for the given field or tag.
|
||||
journalPivot :: Text -> Journal -> Journal
|
||||
|
Loading…
Reference in New Issue
Block a user