Other types

This section contains API documentation for choice and other types, i.e. enums, unions, and literals.

class whenever.Weekday(*values)[source]

Day of the week; .value corresponds with ISO numbering (monday=1, sunday=7).

All members are also available as constants in the module namespace:

>>> from whenever import Weekday, MONDAY, SUNDAY
>>> MONDAY is Weekday.MONDAY
True

Date and other date-carrying types return Weekday from their day_of_week() method:

>>> Date(2024, 12, 25).day_of_week()
Weekday.WEDNESDAY
type whenever.RoundModeStr = Literal['ceil', 'expand', 'floor', 'trunc', 'half_ceil', 'half_expand', 'half_floor', 'half_trunc', 'half_even']

See Modes for more information.

type whenever.DisambiguateStr = Literal['compatible', 'earlier', 'later', 'raise']

See Ambiguity in timezones for more information.

type whenever.DeltaUnitStr = Literal['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds', 'nanoseconds']
type whenever.DateDeltaUnitStr = Literal['years', 'months', 'weeks', 'days']
type whenever.ExactDeltaUnitStr = Literal['weeks', 'days', 'hours', 'minutes', 'seconds', 'nanoseconds']
type whenever.OffsetMismatchStr = Literal['raise', 'keep_instant', 'keep_local']