From dcaba8e4e24766c3570e28fc01d589aa852f0bdd Mon Sep 17 00:00:00 2001 From: KT Date: Sat, 29 Jun 2024 19:10:25 +0800 Subject: [PATCH] fix: Handle ValueError when parsing timezones in SpiralAbyss model --- genshin/models/genshin/chronicle/abyss.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/genshin/models/genshin/chronicle/abyss.py b/genshin/models/genshin/chronicle/abyss.py index 42bf533a..3b73613d 100644 --- a/genshin/models/genshin/chronicle/abyss.py +++ b/genshin/models/genshin/chronicle/abyss.py @@ -116,7 +116,10 @@ def __nest_ranks(cls, values: typing.Dict[str, typing.Any]) -> typing.Dict[str, @pydantic.validator("start_time", "end_time", pre=True) def __parse_timezones(cls, value: str) -> datetime.datetime: - return datetime.datetime.fromtimestamp(int(value), tz=CN_TIMEZONE) + try: + return datetime.datetime.fromtimestamp(int(value), tz=CN_TIMEZONE) + except ValueError: + return datetime.datetime.fromisoformat(value) class SpiralAbyssPair(APIModel):