Skip to content

fix(timezone): honor --timezone local#79

Merged
steipete merged 19 commits intoopenclaw:mainfrom
salmonumbrella:fix/gmail-date-timezone
Jan 17, 2026
Merged

fix(timezone): honor --timezone local#79
steipete merged 19 commits intoopenclaw:mainfrom
salmonumbrella:fix/gmail-date-timezone

Conversation

@salmonumbrella
Copy link
Copy Markdown
Contributor

@salmonumbrella salmonumbrella commented Jan 15, 2026

Summary

  • treat --timezone local as an explicit local override (env/config no longer override it)
  • add Gmail and calendar time coverage for env/local precedence

Fixes #76

Testing

  • make ci

salmonumbrella and others added 19 commits January 17, 2026 04:46
Add --timezone and --local flags to gmail search and watch serve commands
to control how dates are displayed. By default uses local timezone.
Users can specify any IANA timezone (e.g., America/New_York, UTC).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update TestExecute_GmailSearch_JSON to use explicit --timezone UTC flag
and expect the correctly converted time (22:04 UTC from 15:04 -0700).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update calendar time command to follow the same timezone priority as gmail:
1. --timezone flag (explicit)
2. GOG_TIMEZONE env var
3. Config file default_timezone
4. Fall back to Google Calendar's timezone (calendar-specific fallback)

Add getConfiguredTimezone helper that returns nil when no explicit timezone
is configured, allowing calendar commands to use their own fallback behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…zone

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When default_timezone in config is invalid, print a warning to stderr
and fall back to local timezone instead of returning a hard error.

Invalid flag/env var still returns errors (user mistake in current
session), but invalid config should not break the CLI (stale config).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove unused formatGmailDate wrapper function (all callers use
  formatGmailDateInLocation directly with explicit location)
- Add nolint:nilnil directive to getConfiguredTimezone with explanation
  that nil return signals caller to use its own fallback

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@steipete steipete force-pushed the fix/gmail-date-timezone branch from 0675499 to 9973105 Compare January 17, 2026 04:53
@steipete steipete merged commit 05986fb into openclaw:main Jan 17, 2026
4 checks passed
klodr pushed a commit to klodr/gogcli that referenced this pull request Apr 22, 2026
* feat(gmail): add timezone support for date output

Add --timezone and --local flags to gmail search and watch serve commands
to control how dates are displayed. By default uses local timezone.
Users can specify any IANA timezone (e.g., America/New_York, UTC).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(gmail): fix execute test for timezone changes

Update TestExecute_GmailSearch_JSON to use explicit --timezone UTC flag
and expect the correctly converted time (22:04 UTC from 15:04 -0700).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(gmail): add -z short flag for --timezone

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(gmail): add unit tests for resolveOutputLocation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs(gmail): clarify timezone flag help text

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(gmail): add timezone conversion tests for formatGmailDateInLocation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(config): add default_timezone setting

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(gmail): support GOG_TIMEZONE env var and config for timezone

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(config): add gog config command for timezone and settings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(calendar): respect GOG_TIMEZONE and config for timezone

Update calendar time command to follow the same timezone priority as gmail:
1. --timezone flag (explicit)
2. GOG_TIMEZONE env var
3. Config file default_timezone
4. Fall back to Google Calendar's timezone (calendar-specific fallback)

Add getConfiguredTimezone helper that returns nil when no explicit timezone
is configured, allowing calendar commands to use their own fallback behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(gmail): add tests for GOG_TIMEZONE env var and getConfiguredTimezone

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(config): warn on invalid timezone instead of error

When default_timezone in config is invalid, print a warning to stderr
and fall back to local timezone instead of returning a hard error.

Invalid flag/env var still returns errors (user mistake in current
session), but invalid config should not break the CLI (stale config).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(gmail): remove unused formatGmailDate, add nolint directive

- Remove unused formatGmailDate wrapper function (all callers use
  formatGmailDateInLocation directly with explicit location)
- Add nolint:nilnil directive to getConfiguredTimezone with explanation
  that nil return signals caller to use its own fallback

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(timezone): honor --timezone local

* refactor(cli): unify config/timezone helpers

* test(cmd): isolate config env in timezone tests

* refactor(config): centralize config key metadata

* fix(config): drop unused key spec lookup

* fix(config): standardize config key errors

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
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.

Feature: Respect system timezone / add --timezone flag for date output

2 participants