Skip to content

Conversation

@IAseven
Copy link
Contributor

@IAseven IAseven commented Aug 28, 2025

原有问题:
当用户输入日期格式2025-08-28 00:00:00+08:00时,
原有的判断方式
if value.tzinfo != timezone.tz_info: 始终成立,
因为 timezone.tz_infovalue.tzinfo不是同一种类型
一个时区是 UTC+08:00 一个时区是 Asia/Shanghai

Copy link
Member

@wu-clan wu-clan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请更新代码

@wu-clan wu-clan changed the title 🐞 fix:修复时区'Asia/Shanghai'和'+08:00' 不相等的问题 Fix the tzinfo comparison in the timezone type Aug 28, 2025
@IAseven IAseven force-pushed the fix-Error_comparing_timezone_offsets branch from d00b89f to 275e70e Compare August 29, 2025 01:13
@wu-clan wu-clan merged commit 52e7815 into fastapi-practices:master Aug 29, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants