DateRange.until_date

time.DateRange.until_date(start_date, max_end_date, step)

Alternative constructor for DateRange when you aren’t sure of the precise end date: that is, you know roughly when the range ends but aren’t sure if that date is an exact number of steps after start date.

until_date is a class method.

Parameters

start_date: date

The first date in the range.

max_end_date: date

The latest possible date in the range. If max_end_date is already an exact multiple of steps away from start_date, it will be the DateRange’s end date. Otherwise, we will calculate the latest date that is before max_end_date and also an exact multiple of steps after start date.

step: int

The step between dates in the range, as a number of days. Must be 1 or greater.

Returns

DateRange

A new DateRange.