Days

when_exactly.Days

Bases: when_exactly.core.custom_collection.CustomCollection[when_exactly._api.Day]

A collection of Day intervals.

Days provides additional functionality beyond the base Collection, including the ability to get all unique months that the days span.

Attributes:

Name Type Description
months when_exactly._api.Months

All unique months that the days in this collection span.

Example
>>> import when_exactly as wnx
>>> days = wnx.Days([
...     wnx.Day(2025, 1, 1),
...     wnx.Day(2025, 1, 15),
...     wnx.Day(2025, 2, 1),
... ])
>>> len(days)
3
>>> days.months
Months([Month(2025, 1), Month(2025, 2)])

values property

Get the sorted list of unique intervals in this collection.

Returns:

Type Description
list[when_exactly.core.collection.CollectionT]

A sorted list of intervals.

__init__(values)

Initialize a Collection with the given intervals.

Parameters:

Name Type Description Default
values typing.Iterable[when_exactly.core.collection.CollectionT]

An iterable of intervals. Duplicates will be removed and the intervals will be sorted.

required