Skip to content

feat(calendar): add --timezone display override to events and event#908

Closed
bxxd wants to merge 2 commits into
openclaw:mainfrom
bxxd:feat/calendar-events-display-timezone
Closed

feat(calendar): add --timezone display override to events and event#908
bxxd wants to merge 2 commits into
openclaw:mainfrom
bxxd:feat/calendar-events-display-timezone

Conversation

@bxxd

@bxxd bxxd commented Jul 8, 2026

Copy link
Copy Markdown

Summary

  • Add --timezone / --tz to calendar events and calendar event: an explicit display-timezone override (IANA name, or local for the system timezone)
  • Flag unset keeps today's behavior exactly: each calendar's events render in that calendar's own timezone (Calendar events display in wrong timezone (Pacific/Apia instead of system timezone) #493)
  • With an override set, every calendar in an --all/--cal/--calendars listing renders uniformly, and the per-calendar timezone lookups are skipped (they'd be unused)

Why

Real-world failure that motivated this: a household agent builds a daily schedule from calendar events --all -j. Two of the account's nine calendars have their calendar timezone set to UTC — one is a SportsEngine ICS feed import (import calendars commonly come in as UTC and can't be re-zoned), one a Google calendar created with default settings. Google returns their event times in the calendar's timezone, and since #493 the table output and startLocal/endLocal JSON fields render calendar-local — which for these calendars is UTC:

2026-07-08T12:45:00Z | UTC | RP Swim Practice
2026-07-08T20:00:00Z | UTC | Sound 2031 Boys Practice

That 12:45Z is an 8:45am (America/New_York) swim practice. The agent published the family's schedule shifted +4h — swim at "12:45p", an evening practice that was actually 4pm. The stored instants are all correct; there is just no way today to ask the CLI to display them where the viewer lives. --timezone closes that hole while keeping #493's calendar-local default:

$ gog calendar events --all --timezone America/New_York ...
2026-07-08T08:45:00-04:00 | America/New_York | RP Swim Practice
2026-07-08T16:00:00-04:00 | America/New_York | Sound 2031 Boys Practice

Notes:

Test plan

  • make fmt, make lint (0 issues), go test ./internal/... — all packages pass
  • New regressions: UTC-calendar table + JSON output render in the override timezone; multi-calendar path renders uniformly and skips /calendars/<id> lookups (test handler deliberately 404s them); invalid value → usage error exit 2; empty value → no override; Kong-level flag wiring end-to-end
  • Live-verified against the real account that hit this (output above)
  • make docs-commands regenerated

🤖 Implemented with Claude Code, human-reviewed before submission.

Google returns event times in each calendar's timezone, and since openclaw#493 the
table output and startLocal/endLocal JSON fields render calendar-local. That
is the right default, but it has a hole: calendars whose own timezone is UTC
(ICS/SportsEngine feed imports, calendars created with default settings)
display UTC wall-clock with no way to see the times where the viewer lives —
an 8:45am practice stored on a UTC-timezone calendar lists as 12:45Z.

Add --timezone/--tz to 'calendar events' and 'calendar event' as an explicit
display override (IANA name, or 'local' for the system timezone). Empty keeps
the current per-calendar behavior. When set, the override applies uniformly
across --all/--cal listings and skips the per-calendar timezone lookups.
Range parsing (--from/--to/--today) is unchanged.

Display-only, orthogonal to openclaw#905 (event-vs-calendar timezone preference).
Copilot AI review requested due to automatic review settings July 8, 2026 12:07
@clawsweeper

clawsweeper Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 8, 2026, 8:30 AM ET / 12:30 UTC.

Summary
The branch adds --timezone/--tz display overrides to calendar events and calendar event, threads the resolved display location through rendering, updates generated command docs, and adds regression tests.

Reproducibility: not applicable. as a strict bug reproduction: this is a feature PR for a new display override. Source inspection confirms current main and v0.33.0 do not expose that flag, while the PR body gives live output for the motivating UTC-calendar workflow.

Review metrics: 2 noteworthy metrics.

  • Changed surface: 10 files changed, +303/-39. The PR touches command structs, shared calendar rendering, generated docs, and tests, so both CLI entrypoints need maintainer review.
  • New CLI flag surface: 2 commands. Both calendar events and calendar event expose --timezone/--tz, making consistent semantics important before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] This is an additive CLI flag surface; existing calendar and Gmail timezone flag precedents lower compatibility risk, but maintainers still need to accept the product/API direction before merge.

Maintainer options:

  1. Decide the mitigation before merge
    Land the additive display-only override if maintainers accept the flag surface, while preserving calendar-local defaults and keeping event-timezone preference work separate.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P2] The previous review's concrete correctness blocker appears fixed; the remaining action is human acceptance of the new display flag, not an automated repair task.

Maintainer decision needed

  • Question: Should calendar events and calendar event gain an explicit --timezone/--tz display override for viewer-local rendering?
  • Rationale: The patch appears technically sound after the follow-up, but adding a new user-facing CLI flag and alias is a product/API choice that automation should not finalize without maintainer intent.
  • Likely owner: steipete — steipete has the strongest recent history on calendar timezone/display behavior and adjacent calendar CLI flag acceptance.
  • Options:
    • Accept the additive override (recommended): Merge the display-only flag because it preserves existing defaults, follows existing timezone flag precedent, and covers the UTC-calendar scheduling failure with tests and live output.
    • Defer to default-timezone work: Do not add the explicit override now and instead decide whether related event-vs-calendar timezone behavior should solve this workflow without new flag surface.
    • Narrow the surface: Ask for a smaller variant, such as list-only support or different naming, if maintainers want the capability but not both command entrypoints as proposed.

Security
Cleared: The diff only changes Go calendar command rendering, generated command docs, and Go tests; no concrete security or supply-chain concern was found.

Review details

Best possible solution:

Land the additive display-only override if maintainers accept the flag surface, while preserving calendar-local defaults and keeping event-timezone preference work separate.

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

Not applicable as a strict bug reproduction: this is a feature PR for a new display override. Source inspection confirms current main and v0.33.0 do not expose that flag, while the PR body gives live output for the motivating UTC-calendar workflow.

Is this the best way to solve the issue?

Yes, pending maintainer API acceptance. The patch keeps the default calendar-local behavior, adds an explicit display-only override, and fixes the prior single-event weekday mismatch with a focused regression.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a1977274de23.

Label changes

Label changes:

  • add P2: This is a normal-priority additive calendar CLI improvement with a contained user-facing scheduling/output impact and no current blocking correctness finding.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides copied live output from the affected account showing the new override rendering UTC-calendar events in America/New_York, which is sufficient terminal CLI proof for the central behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides copied live output from the affected account showing the new override rendering UTC-calendar events in America/New_York, which is sufficient terminal CLI proof for the central behavior.

Label justifications:

  • P2: This is a normal-priority additive calendar CLI improvement with a contained user-facing scheduling/output impact and no current blocking correctness finding.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides copied live output from the affected account showing the new override rendering UTC-calendar events in America/New_York, which is sufficient terminal CLI proof for the central behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides copied live output from the affected account showing the new override rendering UTC-calendar events in America/New_York, which is sufficient terminal CLI proof for the central behavior.
Evidence reviewed

What I checked:

  • AGENTS.md policy read: Repository review guidance was read fully; its PR-link guidance was applied by using gh pr view/gh pr diff without changing branches or files. (AGENTS.md:1, a1977274de23)
  • PR adds calendar display timezone flags: PR head adds Timezone fields to both CalendarEventsCmd and CalendarEventCmd and resolves the override before dispatching the list/get render paths. (internal/cmd/calendar_events_cmds.go:36, 02492b13fcf9)
  • Override is display-only rendering plumbing: calendarDisplayTimezone returns the override before calendar timezone lookups, and the list paths pass that resolved display timezone into event wrapping/rendering. (internal/cmd/calendar_list.go:302, 02492b13fcf9)
  • Previous review finding fixed: The plain single-event printer now derives weekday fields with eventDaysOfWeekInLocation(event, loc), matching the resolved display location used for local timestamps. (internal/cmd/calendar_print.go:38, 02492b13fcf9)
  • Regression coverage added: PR head includes UTC-calendar table/JSON override tests, selected-calendar lookup skipping, invalid/empty value coverage, Kong wiring, and a cross-date calendar event --timezone weekday regression. (internal/cmd/calendar_events_test.go:580, 02492b13fcf9)
  • Current main and latest release lack the new flag: Current main has no displayTimezoneOverride or Timezone fields on the calendar read commands, and v0.33.0 shows only the command structs without those fields, so this capability is not already implemented or shipped. (internal/cmd/calendar_events_cmds.go:11, a1977274de23)

Likely related people:

  • steipete: GitHub commit history shows recent calendar display/timezone fixes and calendar command refactors in the affected read paths, plus merge involvement in adjacent calendar timezone flag work. (role: recent area contributor and merger; confidence: high; commits: c4df6c34ea96, a92162511fe0, b35481eefd60; files: internal/cmd/calendar_event_days.go, internal/cmd/calendar_events_cmds.go, internal/cmd/calendar_build.go)
  • salmonumbrella: GitHub path history shows the earlier timezone/local-time output helpers and printer extraction used by the affected calendar rendering path. (role: introduced behavior; confidence: medium; commits: 4f29d8e25000, e4207579ad5c, cb9b2408635f; files: internal/cmd/calendar_event_days.go, internal/cmd/calendar_print.go)
  • malob: GitHub history shows recent work on calendar event filtering and the merged write-side --timezone/--tz flag that this PR cites as naming precedent. (role: adjacent feature contributor; confidence: medium; commits: b0bd35e54391, b35481eefd60; files: internal/cmd/calendar_list.go, internal/cmd/calendar_events_cmds.go, internal/cmd/calendar_build.go)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

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.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-08T12:11:40.398Z sha fcaf707 :: needs changes before merge. :: [P2] Compute event weekdays in the override timezone

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a display-only timezone override to the calendar read commands so users (and automations) can force all rendered event times into a single viewer timezone without changing how events are stored or how time ranges are parsed.

Changes:

  • Add --timezone/--tz to gog calendar events and gog calendar event to override displayed event times (IANA zone or local).
  • Thread a resolved display-timezone hint through event listing/single-event paths, skipping per-calendar timezone lookups when an override is set.
  • Add regression + wiring tests and regenerate command docs.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/cmd/calendar_zoom_test.go Updates helper call signature for listCalendarEvents to include the new display timezone parameter.
internal/cmd/calendar_list.go Adds display timezone override plumbing (displayTimezoneOverride, calendarDisplayTimezone override parameter) and threads it through list paths.
internal/cmd/calendar_events_test.go Refactors test handler for reuse and adds coverage for override behavior, invalid/empty values, and “skip calendar lookups” behavior.
internal/cmd/calendar_events_cmds.go Wires --timezone/--tz into calendar events and calendar event commands and applies the override at render time.
internal/cmd/calendar_changed.go Updates calendarDisplayTimezone call sites for the new function signature.
internal/cmd/calendar_all_events_test.go Updates listAllCalendarsEvents call sites for the new display timezone parameter.
docs/commands/gog-calendar-events.md Documents the new --timezone/--tz flag for calendar events.
docs/commands/gog-calendar-event.md Documents the new --timezone/--tz flag for calendar event and updates usage to include [flags].
docs/commands.generated.md Regenerates the command index entry to reflect calendar event now accepting flags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ation

Review follow-up: printCalendarEventWithTimezone formatted start-local/
end-local in the resolved display location but still computed
start-day-of-week/end-day-of-week without it, so an instant that changes
date in the override timezone could print a mismatched weekday. Use
eventDaysOfWeekInLocation with the same resolved location (matching the
JSON path) and add a CalendarEventCmd regression where the override
crosses midnight (02:00Z Wednesday -> 22:00 Tuesday America/New_York).
@bxxd

bxxd commented Jul 8, 2026

Copy link
Copy Markdown
Author

Both review findings addressed in 02492b1:

  • Weekday/location mismatch: printCalendarEventWithTimezone now derives start-day-of-week/end-day-of-week via eventDaysOfWeekInLocation with the same resolved display location used for start-local/end-local, matching what the JSON path (wrapEventWithDaysWithTimezone) already did. This also fixes the pre-existing mismatch when a calendar/event timezone crosses midnight relative to the display location, independent of the new flag.
  • Focused regression: TestCalendarEventCmd_TimezoneOverrideCrossDateWeekday — a 02:00Z Wednesday event with --timezone America/New_York must print start-local 2026-07-07T22:00:00-04:00 with start-day-of-week/end-day-of-week Tuesday.

make fmt / make lint (0 issues) / go test ./internal/... all pass.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal priority bug or improvement with limited blast radius. labels Jul 8, 2026
steipete added a commit that referenced this pull request Jul 11, 2026
@steipete

Copy link
Copy Markdown
Collaborator

Landed on main as 3942562. Thank you, @bxxd!

Maintainer follow-up integrated the event-timezone behavior from #905 and added explicit precedence coverage: --timezone wins over event timezone, event timezone wins over calendar timezone, and calendar timezone remains the fallback. The combined tests also cover cross-midnight weekdays, JSON/table output, multi-calendar lookup skipping, invalid/empty values, and corrected user-facing default documentation. Proof: focused calendar tests, full make ci, and clean autoreview.

@steipete steipete closed this Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants