Skip to content

Commit

Permalink
Fix timezone issue in ClaimedDailyReward
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Sep 19, 2024
1 parent 9099c65 commit 99d99fb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions genshin/models/genshin/daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import datetime
import typing

import pydantic
import pydantic.v1 as pydantic

from genshin.constants import CN_TIMEZONE
from genshin.models.model import Aliased, APIModel, Unique
Expand Down Expand Up @@ -40,7 +40,6 @@ class ClaimedDailyReward(APIModel, Unique):
icon: str = Aliased("img")
time: datetime.datetime = Aliased("created_at")

@pydantic.field_validator("time")
@classmethod
@pydantic.validator("time")
def __add_timezone(cls, value: datetime.datetime) -> datetime.datetime:
return value.replace(tzinfo=CN_TIMEZONE)

0 comments on commit 99d99fb

Please sign in to comment.