Skip to content

Commit 52e7815

Browse files
authored
Fix the tzinfo comparison in the timezone type (#787)
1 parent dcb07c6 commit 52e7815

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

backend/common/model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ def python_type(self) -> type[datetime]:
6363

6464
def process_bind_param(self, value: datetime | None, dialect) -> datetime | None:
6565
if value is not None:
66-
if value.tzinfo != timezone.tz_info:
66+
# TODO 处理夏令时偏移
67+
if value.utcoffset() != timezone.now().utcoffset():
6768
value = timezone.from_datetime(value)
6869
return value
6970

0 commit comments

Comments
 (0)