Skip to content

bug(calendar): --sort start places all-day events at midnight UTC instead of the calendar's timezone #1284

Closed

Description

@privatenumber

Summary

For a calendar in a non-UTC timezone, calendar events --sort start orders an all-day event by midnight UTC. In Asia/Tokyo, an all-day event on 2026-11-03 sorts after an 08:00 event on the same day.

Current (v0.47.1)

gog calendar events --cal 1 --from 2026-11-03 --days 1 --sort start   # calendar timeZone Asia/Tokyo
# timed1   2026-11-03T08:00:00+09:00  …  Breakfast
# allday1  2026-11-03                 …  Holiday

All-day start.date values have no timeZone, so parseEventDate parses them in UTC (calendar_event_days.go#L142-L155, via calendar_list.go#L470).

Suggested

Fall back to the event's calendar timezone (already known for display) when parsing an all-day date for sorting.

Environment

gog v0.47.1 (main at 82e7fd6). Reproduced against a local fake of the Calendar API through GOG_GOOGLE_API_BASE_URL.

Activity

  1. added
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    P2Normal priority bug or improvement with limited blast radius.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    no-staleExempts this issue from stale automation.
    and removed
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    on Oct 31, 2026
  2. clawsweeper commented on Oct 31, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work.

    Summary
    Keep this issue open: current main still discards the calendar timezone when sorting all-day events, and no open PR owns the repair.

    Reproducibility: Current source proves the Tokyo example through the sort comparator and UTC date fallback; the reporter supplies a fake-API reproduction, but this review ran no executable reproduction or tests.

    Next step
    Establish a failing Tokyo mixed-event regression, then carry calendar timezone into date-only start and end sort keys without changing display override semantics.

    Review details

    Best possible solution:

    Sort date-only endpoints at midnight in their containing calendar timezone while preserving timed-event instants and display-only overrides.

    Do we have a high-confidence way to reproduce the issue?

    Current source proves the Tokyo example through the sort comparator and UTC date fallback; the reporter supplies a fake-API reproduction, but this review ran no executable reproduction or tests.

    Is this the best way to solve the issue?

    A focused timezone fallback repair is appropriate, provided it retains calendar timezone separately from viewer display metadata and covers both start and end sorting.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The wrapper's Timezone may hold a viewer override, so using it directly as the all-day sort fallback could make display settings change chronological ordering.

    Codex review notes: model internal, reasoning medium; reviewed against 82e7fd6005d4.

    Label changes

    Label changes:

    • add P2: Explicit chronological sorting produces incorrect ordering for mixed all-day and timed events outside UTC, without losing events or blocking the command.
    • add impact:ux-friction: Calendar listings present a misleading daily schedule that users or agents must reinterpret.
    • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
    • add clawsweeper:source-repro: Current issue advisory state selects this label.
    • add clawsweeper:queueable-fix: Current issue advisory state selects this label.
    • add clawsweeper:fix-shape-clear: Current issue advisory state selects this label.

    Label justifications:

    • P2: Explicit chronological sorting produces incorrect ordering for mixed all-day and timed events outside UTC, without losing events or blocking the command.
    • impact:ux-friction: Calendar listings present a misleading daily schedule that users or agents must reinterpret.
    Evidence reviewed

    Acceptance criteria:

    • Establish the failing Asia/Tokyo all-day versus 08:00 regression before implementing the fix.
    • go test ./internal/cmd -run 'TestListCalendarEvents|TestListSelectedCalendarsEvents|TestListAllCalendarsEvents|TestSortEventsBy|TestEventDaysOfWeek|TestDisplayTimezoneOverride' -count=1
    • make ci
    • Run the built CLI against an isolated Calendar API fixture for 2026-11-03 in Asia/Tokyo and verify allday1 precedes timed1 with --sort start, including JSON and table output.

    What I checked:

    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed October 30, 2026, 11:11 PM ET / October 31, 2026, 03:11 UTC.

  3. steipete commented on Nov 5, 2026

    @steipete
    Collaborator

    Fixed by #1301 in d358b6c. A Tokyo all-day event now sorts before 08:00, including partial fields and a New York display-timezone override. Reproduced before and verified after through the built CLI against a synthetic Calendar API. Regression tests, independent P0–P2 review, and final-head CI pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExempts this issue from stale automation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions