everyDuration

fnTP delegate(return scope const TP) everyDuration(TP, Direction dir = Direction.fwd, D)(D duration) if (isTimePoint!TP && __traits(compiles, TP.init + duration) && (dir == Direction.fwd || dir == Direction.bwd)) nothrow

Range-generating function.

Returns a delegate which returns the next time point which is the given duration later.

Using this delegate allows iteration over successive time points which are apart by the given duration e.g. passing dur!"days"(3) to everyDuration would result in a delegate which could be used to iterate over a range of days which are each 3 days apart.

Parameters

dirThe direction to iterate in. If passing the return value to fwdRange, use Direction.fwd. If passing it to bwdRange, use Direction.bwd.
durationThe duration which separates each successive time point in the range.
fnTP delegate(scope const TP) everyDuration(TP, Direction dir = Direction.fwd, D)(int years, int months = 0, AllowDayOverflow allowOverflow = AllowDayOverflow.yes, D duration = dur!"days"(0)) if (isTimePoint!TP && __traits(compiles, TP.init + duration) && __traits(compiles, TP.init.add!"years"(years)) && __traits(compiles, TP.init.add!"months"(months)) && (dir == Direction.fwd || dir == Direction.bwd)) nothrow

Range-generating function.

Returns a delegate which returns the next time point which is the given number of years, month, and duration later.

The difference between this version of everyDuration and the version which just takes a Duration is that this one also takes the number of years and months (along with an AllowDayOverflow to indicate whether adding years and months should allow the days to overflow).

Note that if iterating forward, add!"years"() is called on the given time point, then add!"months"(), and finally the duration is added to it. However, if iterating backwards, the duration is added first, then add!"months"() is called, and finally add!"years"() is called. That way, going backwards generates close to the same time points that iterating forward does, but since adding years and months is not entirely reversible (due to possible day overflow, regardless of whether AllowDayOverflow.yes or AllowDayOverflow.no is used), it can't be guaranteed that iterating backwards will give the same time points as iterating forward would have (even assuming that the end of the range is a time point which would be returned by the delegate when iterating forward from begin).

Parameters

dirThe direction to iterate in. If passing the return value to fwdRange, use Direction.fwd. If passing it to bwdRange, use Direction.bwd.
yearsThe number of years to add to the time point passed to the delegate.
monthsThe number of months to add to the time point passed to the delegate.
allowOverflowWhether the days should be allowed to overflow on begin and end, causing their month to increment.
durationThe duration to add to the time point passed to the delegate.