A partition of time into one or more contiguous periods,
plus a historical period that precedes them.
Note DayPartition does not store per-period data - only the periods' start/end dates.
Instances3Eq, Ord, Show
EqDayPartitionDefined in hledger-lib-1.52.4 · Hledger.Data.DayPartition
OrdDayPartitionDefined in hledger-lib-1.52.4 · Hledger.Data.DayPartition
ShowDayPartitionDefined in hledger-lib-1.52.4 · Hledger.Data.DayPartition
Convert DayPartition to a non-empty list of period start and end dates (both inclusive).
Each end date will be one day before the next period's start date.
Convert DayPartition to a list (which will always be non-empty) of period start and end dates (both inclusive).
Each end date will be one day before the next period's start date.
Convert DayPartition to a list of DateSpans.
Each span will end one day before the next span begins
(the span's exclusive end date will be equal to the next span's start date).
Find the start and end dates of the period within a DayPartition which contains a given day.
If the day is after the end of the last period, it is assumed to be within the last period.
If the day is before the start of the first period (ie, in the historical period),
only the historical period's end date is returned.
Split a DateSpan into a DayPartition consisting of consecutive exact
spans of the specified Interval, or Nothing if the span is invalid.
If no interval is specified, the original span is returned.
If the original span is the null date span, ie unbounded, Nothing is returned.
If the original span is empty, eg if the end date is <= the start date, Nothing is returned.
Date adjustment
Some intervals respect the "adjust" flag (years, quarters, months, weeks, every Nth weekday
of month seem to be the ones that need it). This will move the start date earlier, if needed,
to the previous natural interval boundary (first of year, first of quarter, first of month,
monday, previous Nth weekday of month). Related: #1982 #2218
The end date is always moved later if needed to the next natural interval boundary,
so that the last period is the same length as the others.