This commit is contained in:
doms9 2025-10-02 12:57:25 -04:00
parent 9caa2f50d1
commit 00000d9342
6 changed files with 10 additions and 12 deletions

View file

@ -26,6 +26,10 @@ class Time(datetime):
new_dt = super().__add__(timedelta(**kwargs))
return self.__class__.fromtimestamp(new_dt.timestamp(), tz=new_dt.tzinfo)
def clean(self) -> "Time":
new_dt = super().replace(second=0, microsecond=0)
return self.__class__.fromtimestamp(new_dt.timestamp(), tz=new_dt.tzinfo)
@classmethod
def from_str(cls, s: str, fmt: str | None = None) -> "Time":
pattern = r"\b(ET|UTC|EST|EDT)\b"