Month

when_exactly.Month dataclass

Bases: when_exactly.core.custom_interval.CustomInterval

Represents a calendar month from the first day to the last day.

A Month spans from 00:00:00 on the first day of the month to 00:00:00 on the first day of the next month (exclusive).

Attributes:

Name Type Description
start when_exactly.core.moment.Moment

The moment at the beginning of the month (inclusive).

stop when_exactly.core.moment.Moment

The moment at the beginning of the next month (exclusive).

Example
>>> import when_exactly as wnx
>>> month = wnx.Month(2025, 1)
>>> month
Month(2025, 1)
>>> str(month)
'2025-01'
>>> len(list(month.days()))
31
>>> month.next
Month(2025, 2)