openclaw - 💡(How to fix) Fix cron: --tz flag is silently ignored for one-shot --at jobs [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#78193Fetched 2026-05-06 06:16:03
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Timeline (top)
closed ×1commented ×1

The --tz <iana> option is registered and documented for --at one-shot jobs, but it is never passed to the parser. As a result, one-shot times are always interpreted as UTC (or offset-less local), and --tz is silently ignored.

Error Message

  1. Update the help text and option registration to clearly state that --tz only applies to --cron schedules (and error/warn when used with --at).

Root Cause

In src/cli/cron-cli/register.cron-add.ts:149:

if (at) {
  const atIso = parseAt(at);           // ← tz is never passed
  ...
  return { kind: "at", at: atIso };
}

The tz option is only forwarded in the --cron branch (around line 178). The parseAt() function itself has no tz parameter in the current source, and the offset-less + IANA path that existed in the compiled bundle was never wired up for one-shots.

This is why https://github.com/openclaw/openclaw/issues/78156 was closed as "not reproducible" — the code path the reporter expected did not exist.

Code Example

openclaw cron add --name "repro-tz" \
  --at "2026-05-06T10:00" \
  --tz "America/Chicago" \
  --system-event "test"

---

openclaw cron list --json | jq '.jobs[] | select(.name=="repro-tz") | .schedule'

---

{
  "kind": "at",
  "at": "2026-05-06T10:00:00.000Z"   // treated as UTC
}

---

{
  "kind": "at",
  "at": "2026-05-06T15:00:00.000Z"   // 10:00 CDT = 15:00 UTC
}

---

if (at) {
  const atIso = parseAt(at);           // ← tz is never passed
  ...
  return { kind: "at", at: atIso };
}
RAW_BUFFERClick to expand / collapse

Summary

The --tz <iana> option is registered and documented for --at one-shot jobs, but it is never passed to the parser. As a result, one-shot times are always interpreted as UTC (or offset-less local), and --tz is silently ignored.

Reproduction

openclaw cron add --name "repro-tz" \
  --at "2026-05-06T10:00" \
  --tz "America/Chicago" \
  --system-event "test"

Inspect the stored job:

openclaw cron list --json | jq '.jobs[] | select(.name=="repro-tz") | .schedule'

Actual stored schedule:

{
  "kind": "at",
  "at": "2026-05-06T10:00:00.000Z"   // treated as UTC
}

Expected (if --tz were honored):

{
  "kind": "at",
  "at": "2026-05-06T15:00:00.000Z"   // 10:00 CDT = 15:00 UTC
}

Root Cause

In src/cli/cron-cli/register.cron-add.ts:149:

if (at) {
  const atIso = parseAt(at);           // ← tz is never passed
  ...
  return { kind: "at", at: atIso };
}

The tz option is only forwarded in the --cron branch (around line 178). The parseAt() function itself has no tz parameter in the current source, and the offset-less + IANA path that existed in the compiled bundle was never wired up for one-shots.

This is why https://github.com/openclaw/openclaw/issues/78156 was closed as "not reproducible" — the code path the reporter expected did not exist.

Affected Code

  • src/cli/cron-cli/register.cron-add.ts (and the edit equivalent)
  • src/cli/cron-cli/shared.tsparseAt(input) (no tz overload)

Suggested Fix

Either:

  1. Extend parseAt(input, tz?) to support the offset-less + --tz case for one-shots, or
  2. Update the help text and option registration to clearly state that --tz only applies to --cron schedules (and error/warn when used with --at).

The first option is more useful and matches user expectation from the current help text.

extent analysis

TL;DR

The most likely fix is to extend the parseAt(input, tz?) function to support the offset-less + --tz case for one-shots.

Guidance

  • Verify the issue by checking the stored job schedule using the provided openclaw cron list --json command and comparing it to the expected schedule.
  • To fix the issue, extend the parseAt(input, tz?) function in src/cli/cron-cli/shared.ts to accept an optional tz parameter and use it to parse the at input with the correct timezone offset.
  • Update the register.cron-add.ts file to pass the tz option to the parseAt() function when the --at option is used.
  • Consider adding error handling or warnings when the --tz option is used with --at to prevent silent failures.

Example

// In src/cli/cron-cli/shared.ts
function parseAt(input: string, tz?: string) {
  // Implement timezone-aware parsing using the provided tz parameter
  // ...
}

// In src/cli/cron-cli/register.cron-add.ts
if (at) {
  const atIso = parseAt(at, tz); // Pass tz to parseAt()
  // ...
}

Notes

The suggested fix assumes that the parseAt() function can be extended to support timezone-aware parsing. If this is not possible, updating the help text and option registration to clearly state the limitations of the --tz option may be a viable alternative.

Recommendation

Apply workaround by extending the parseAt(input, tz?) function to support the offset-less + --tz case for one-shots, as this matches user expectation and provides a more useful solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING