Bases: BaseModel
Bespoke immutable date class designed to simplify working with times,
in particular input parsing, time calculations, and ranges.
hour
class-attribute
instance-attribute
hour: int = Field(frozen=FROZEN)
minute
class-attribute
instance-attribute
minute: int = Field(default=0, frozen=FROZEN)
model_config
class-attribute
instance-attribute
model_config = ConfigDict(frozen=FROZEN)
second
class-attribute
instance-attribute
second: float = Field(default=0.0, frozen=FROZEN)
__add__
__add__(mins: int | float) -> Time
__and__
__and__(date: Date) -> DateTime
__eq__
__eq__(other: Any) -> bool
__ge__
__ge__(other: Time) -> bool
__gt__
__gt__(other: Time) -> bool
__le__
__le__(other: Time) -> bool
__lt__
__lt__(other: Time) -> bool
__rshift__
__rshift__(other: Time) -> TimeSpan
__sub__
__sub__(mins: int) -> Time
_ceiling
staticmethod
_ceiling(raw_units: float, increment: int | float) -> float
_floor
staticmethod
_floor(raw_units: float, increment: int | float) -> float
_round_to
staticmethod
_round_to(raw_units: float, round_to: int | float, round_down: bool) -> float
_sub
_sub(mins: int | float) -> Time
add_hours_bounded
add_hours_bounded(n: int | float) -> Time
add_hours_wraparound
add_hours_wraparound(n: int | float) -> tuple[Time, int]
add_minutes_bounded
add_minutes_bounded(n: int | float) -> Time
add_minutes_wraparound
add_minutes_wraparound(n: int | float) -> tuple[Time, int]
add_seconds_bounded
add_seconds_bounded(n: int | float) -> Time
add_seconds_wraparound
add_seconds_wraparound(n: int | float) -> tuple[Time, int]
ceiling_hours
ceiling_hours(increment: int | float = 1) -> Time
ceiling_minutes
ceiling_minutes(increment: int | float = 1) -> Time
ceiling_seconds
ceiling_seconds(increment: int | float = 1) -> Time
floor_hours
floor_hours(increment: int | float = 1) -> Time
floor_minutes
floor_minutes(increment: int | float = 1) -> Time
floor_seconds
floor_seconds(increment: int | float = 1) -> Time
from_hours
classmethod
from_hours(hours: int | float, places: int | None = None) -> Time
from_minutes
classmethod
from_minutes(minutes: int | float, places: int | None = None) -> Time
from_seconds
classmethod
from_seconds(seconds: int | float, places: int | None = None) -> Time
hours_from
hours_from(time2: Time) -> float
hours_from_last
hours_from_last(time2: Time) -> float
hours_to
hours_to(time2: Time) -> float
hours_to_next
hours_to_next(time2: Time) -> float
if_valid
classmethod
if_valid(time_string: str) -> Self | None
Parse a string and return an instance of Time if possible; otherwise None.
minutes_from
minutes_from(time2: Time) -> float
minutes_from_last
minutes_from_last(time2: Time) -> float
minutes_to
minutes_to(time2: Time) -> float
minutes_to_next
minutes_to_next(time2: Time) -> float
parse
classmethod
parse(time_string: str) -> Self
round_hours
round_hours(round_to: int | float = 1, round_down: bool = False) -> Time
round_minutes
round_minutes(round_to: int | float = 1, round_down: bool = False) -> Time
round_seconds
round_seconds(round_to: int | float = 1, round_down: bool = False) -> Time
seconds_from
seconds_from(time2: Time) -> float
seconds_from_last
seconds_from_last(time2: Time) -> float
seconds_to
seconds_to(time2: Time) -> float
seconds_to_next
seconds_to_next(time2: Time) -> float
span
span(other: Time, name: str | None = None) -> TimeSpan
to
to(other: Time) -> TimeSpan
to_hours
to_hours(places: int | None = None) -> float
to_minutes
to_minutes(places: int | None = None) -> float
to_seconds
to_seconds(places: int | None = None) -> float
validate_time
classmethod
validate_time(raw_time: str | dict | list | tuple) -> dict[str, str | int | float]