diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-23 16:15:09 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-23 16:15:09 -1000 |
| commit | e23c85577cbb0eac8b847dd989072698ff4e7a30 (patch) | |
| tree | a4a19650fc67d97c626f75ed6f19b9c17d70d894 /internal/api | |
| parent | 7828e19501b3ca8b2e86ca7297f580c659e5c9b8 (diff) | |
Fix calendar dedup: use Unix timestamp to handle timezone differences
Events copied across calendars may have different timezone representations
in their RFC3339 strings. Using Unix timestamps ensures the same moment
in time produces the same dedup key.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/api')
| -rw-r--r-- | internal/api/google_calendar.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/api/google_calendar.go b/internal/api/google_calendar.go index 2154351..919976b 100644 --- a/internal/api/google_calendar.go +++ b/internal/api/google_calendar.go @@ -77,11 +77,12 @@ func (c *GoogleCalendarClient) GetUpcomingEvents(ctx context.Context, maxResults } // Deduplicate events (same event may appear in multiple calendars) + // Use Unix timestamp to handle timezone differences seen := make(map[string]bool) var uniqueEvents []models.CalendarEvent for _, event := range allEvents { - // Use summary + start time as dedup key - key := event.Summary + event.Start.Format(time.RFC3339) + // Use summary + unix timestamp as dedup key (handles timezone differences) + key := fmt.Sprintf("%s|%d", event.Summary, event.Start.Unix()) if !seen[key] { seen[key] = true uniqueEvents = append(uniqueEvents, event) |
