Preserve Time When Setting Recurrence and Clear Recurrence from Google Calendar #1540
+58
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes two related issues with recurrence handling and Google Calendar sync:
Time preservation: When setting a new recurrence on a task with a scheduled time, the time component was lost, causing Google Calendar events to appear as all-day instead of at the specified time.
Recurrence clearing: When clearing recurrence from a task synced to Google Calendar, the recurrence rule wasn't properly removed from the calendar event.
Problem
Issue 1: Time Loss in Recurrence
Before:
scheduled: 2026-01-27T18:39(with time)DTSTART:20260127;FREQ=WEEKLY(date-only)After:
scheduled: 2026-01-27T18:39(with time)DTSTART:20260127T183900Z;FREQ=WEEKLY(with time)Issue 2: Recurrence Not Cleared from Google Calendar
Before:
After:
recurrence: []to remove recurrence ✓Root Causes
Issue 1: Time Preservation
RecurrenceContextMenu.getRecurrenceOptions()only checked for time in existing recurrence rules (currentValue). When setting a new recurrence on a task with scheduled time but no existing recurrence, it didn't check the task's scheduled date for time information.Issue 2: Recurrence Clearing
TaskCalendarSyncService.taskToCalendarEvent()omitted therecurrenceproperty entirely when a task had no recurrence. Google Calendar API requires an explicit empty array (recurrence: []) to remove existing recurrence rules.Solution
Fix 1: Preserve Time from Scheduled Date
RecurrenceContextMenuOptionsinterface to includescheduledDate?: stringgetRecurrenceOptions()to check scheduled date for time when no existing recurrence time exists:CustomRecurrenceModalto accept and use scheduled date, pre-filling time fieldtask.scheduledwhen creatingRecurrenceContextMenuFix 2: Explicitly Clear Recurrence
previousTaskStatemap to track previous task state for detecting recurrence removaltaskToCalendarEvent()to acceptclearRecurrenceparametersyncTaskToCalendar()to detect when recurrence was removed and passclearRecurrence: truerecurrence: []explicitly when clearing recurrence to tell Google Calendar API to remove itChanges Made
Files Modified
src/components/RecurrenceContextMenu.tsscheduledDatetoRecurrenceContextMenuOptionsinterfacegetRecurrenceOptions()to check scheduled date for timeCustomRecurrenceModalconstructor andparseCurrentValue()showCustomRecurrenceModal()to pass scheduled datesrc/services/TaskCalendarSyncService.tspreviousTaskStatemap for tracking previous task statetaskToCalendarEvent()to acceptclearRecurrenceparametersyncTaskToCalendar()to detect recurrence removalupdateTaskInCalendar()andexecuteTaskUpdate()to track and pass previous statesrc/ui/TaskCard.tsscheduledDate: task.scheduledwhen creatingRecurrenceContextMenusrc/bases/TaskListView.tsscheduledDate: task.scheduledwhen creatingRecurrenceContextMenusrc/bases/KanbanView.tsscheduledDate: task.scheduledwhen creatingRecurrenceContextMenusrc/components/TaskContextMenu.tsscheduledDate: this.options.task.scheduledwhen creatingRecurrenceContextMenusrc/modals/TaskModal.tsscheduledDate: this.scheduledDatewhen creatingRecurrenceContextMenuTest Files Created
e2e/issues/issue-clear-recurrence-google-calendar.spec.ts- Tests for recurrence clearinge2e/issues/issue-preserve-time-in-recurrence.spec.ts- Tests for time preservationTesting
Time Preservation:
scheduled: 2026-01-27T18:39DTSTART:20260127T183900ZRecurrence Clearing:
Custom Recurrence Modal:
Impact
User Experience
Technical
YYYYMMDDTHHMMSSZ)recurrence: [])Related Issues
Fixes issues where:
Checklist