e
This commit is contained in:
parent
8ed4482bfb
commit
00000d9296
4 changed files with 166 additions and 129 deletions
|
|
@ -8,6 +8,7 @@ import pytz
|
|||
|
||||
class Time(datetime):
|
||||
ZONES = {
|
||||
"CET": pytz.timezone("Europe/Berlin"),
|
||||
"ET": pytz.timezone("America/New_York"),
|
||||
"PST": pytz.timezone("America/Los_Angeles"),
|
||||
"UTC": timezone.utc,
|
||||
|
|
@ -53,7 +54,7 @@ class Time(datetime):
|
|||
fmt: str | None = None,
|
||||
) -> "Time":
|
||||
|
||||
pattern = re.compile(r"\b(ET|UTC|EST|EDT|PST)\b")
|
||||
pattern = re.compile(rf"\b({"|".join(cls.ZONES.keys())})\b")
|
||||
|
||||
match = pattern.search(s)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue