Skip to content

Fix: Resolve due date validation and format conversion for TickTick API#29

Open
mahmoudfazeli wants to merge 1 commit into
jacepark12:mainfrom
mahmoudfazeli:fix-due-date-field-mapping
Open

Fix: Resolve due date validation and format conversion for TickTick API#29
mahmoudfazeli wants to merge 1 commit into
jacepark12:mainfrom
mahmoudfazeli:fix-due-date-field-mapping

Conversation

@mahmoudfazeli

Copy link
Copy Markdown

🐛 Bug Fix: Due Date Validation and Format Conversion

Problem

Due dates were not appearing in TickTick app despite successful task creation. Users experienced "Invalid due_date format" errors with valid ISO dates containing timezone offsets.

Root Cause

Python's datetime.fromisoformat() requires timezone offsets with colons (+02:00) but TickTick API expects formats without colons (+0200).

Solution

  • Smart timezone format detection and normalization
  • Handle Z, +0000, +HHMM, and no-timezone formats
  • Normalize for Python validation, convert back for TickTick API
  • Applied to both create_task and update_task functions

Testing

✅ Verified due dates now appear correctly in TickTick app
✅ All common ISO date formats supported
✅ Backward compatibility maintained

Impact

Enables proper due date functionality for reminders, schedules, and deadlines management.

try:
# Try to parse the date to validate it
datetime.fromisoformat(date_str.replace("Z", "+00:00"))
# Normalize the date for validation (Python expects colons in timezone)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

It seems this change is equivalent to the changes in lines 339–375.

To improve readability and avoid duplication, I think this logic should be extracted into a separate function.

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