Problem
The DATETIME_FORMAT_V2 constant in constants.py hardcodes +0000 (UTC) as the timezone suffix:
DATETIME_FORMAT_V2 = "%Y-%m-%dT%H:%M:%S.000+0000"
This causes timezone information to be lost when formatting datetime objects with non-UTC timezones.
Impact
When creating/updating tasks with a timezone-aware datetime (e.g., Shanghai timezone +08:00), the formatted string incorrectly shows +0000 instead of the actual timezone offset. This can lead to incorrect date display in the TickTick/Dida365 app.
Example
from datetime import datetime
from zoneinfo import ZoneInfo
from ticktick_sdk.models.base import TickTickModel
shanghai_tz = ZoneInfo('Asia/Shanghai')
dt = datetime(2026, 3, 24, 0, 0, 0, tzinfo=shanghai_tz)
formatted = TickTickModel.format_datetime(dt, "v2")
# Current output: 2026-03-24T00:00:00.000+0000 ❌ Wrong timezone!
# Expected output: 2026-03-24T00:00:00.000+0800 ✅ Correct timezone!
Root Cause
The format string uses a hardcoded +0000 literal instead of the %z format specifier.
Proposed Fix
Change line 232 in ticktick_sdk/constants.py:
# Before
DATETIME_FORMAT_V2 = "%Y-%m-%dT%H:%M:%S.000+0000"
# After
DATETIME_FORMAT_V2 = "%Y-%m-%dT%H:%M:%S.000%z"
The %z specifier will output the correct timezone offset (e.g., +0800, +0000, -0500).
Verification
After applying this fix:
dt = datetime(2026, 3, 24, 0, 0, 0, tzinfo=shanghai_tz)
formatted = TickTickModel.format_datetime(dt, "v2")
# Output: 2026-03-24T00:00:00.000+0800 ✅
The task will now be created with the correct timezone information, and the date will display correctly in the user's timezone.
Environment
- ticktick-sdk version: 0.4.3
- Python version: 3.14
- Platform: macOS
- Host: dida365.com (Chinese version)
Thank you for this excellent SDK!
Problem
The
DATETIME_FORMAT_V2constant inconstants.pyhardcodes+0000(UTC) as the timezone suffix:This causes timezone information to be lost when formatting datetime objects with non-UTC timezones.
Impact
When creating/updating tasks with a timezone-aware datetime (e.g., Shanghai timezone
+08:00), the formatted string incorrectly shows+0000instead of the actual timezone offset. This can lead to incorrect date display in the TickTick/Dida365 app.Example
Root Cause
The format string uses a hardcoded
+0000literal instead of the%zformat specifier.Proposed Fix
Change line 232 in
ticktick_sdk/constants.py:The
%zspecifier will output the correct timezone offset (e.g.,+0800,+0000,-0500).Verification
After applying this fix:
The task will now be created with the correct timezone information, and the date will display correctly in the user's timezone.
Environment
Thank you for this excellent SDK!