Calendar.join#

Calendar.join(other, *, on=None) Calendar#

Returns a new Calendar containing dates in self (to and including the given on date) and dates in other (from and including the on date).

If on is not provided, defaults to the last date in self.

Parameters:
  • other (iterable) – Other calendar

  • on (datetime.date) – date from which to join the two calendars together

Return type:

Calendar

Examples

>>> import doubledate as dtwo

>>> this = dtwo.Calendar(
...     [
...         dtwo.date(2023,1,1),
...         dtwo.date(2023,2,1),
...         dtwo.date(2023,3,1),
...     ]
... )

>>> that = dtwo.Calendar(
...     [
...         dtwo.date(2023,1,15),
...         dtwo.date(2023,2,15),
...         dtwo.date(2023,3,15),
...     ]
... )

>>> this.join(that)
<doubledate.calendar.Calendar at 0x17045b0e830>

>>> this.join(that).dates
[datetime.date(2023, 1, 1), datetime.date(2023, 2, 1),
 datetime.date(2023, 3, 1), datetime.date(2023, 3, 15)]

>>> this.join(that, on=dtwo.date(2023,2,15)).dates
[datetime.date(2023, 1, 1), datetime.date(2023, 2, 1),
 datetime.date(2023, 2, 15), datetime.date(2023, 3, 15)]