Calendar.generate#

classmethod Calendar.generate(starting: date, ending: date)#

Creates a new calendar with all the calendar days between the starting and ending dates, with both bounds included.

Parameters:
  • starting (datetime.date) – the starting date

  • ending (datetime.date) – the ending date

Returns:

the calendar

Return type:

Calendar

Example

>>> import datetime
>>> import doubledate as dtwo

>>> calendar = dtwo.Calendar.generate(
...     starting=datetime.date(2021,1,1),
...     ending=datetime.date(2021,12,31)
... )
>>> len(calendar)
365

>>> calendar[0]
datetime.date(2021,1,1)

>>> calendar[-1]
datetime.date(2021,12,31)