16 lines
488 B
Python
16 lines
488 B
Python
from __future__ import annotations
|
|
from datetime import time
|
|
from typing import Tuple
|
|
import zoneinfo
|
|
|
|
WARSAW_TZ = zoneinfo.ZoneInfo("Europe/Warsaw")
|
|
UTC = zoneinfo.ZoneInfo("UTC")
|
|
TimeRange = Tuple[time, time]
|
|
|
|
def in_range_local(t_local: time, rng: TimeRange) -> bool:
|
|
"""[start, end) in local time, supports ranges crossing midnight."""
|
|
start, end = rng
|
|
if start <= end:
|
|
return start <= t_local < end
|
|
return (t_local >= start) or (t_local < end)
|