Skip to content

docs(cron): note UTC->local time-zone change in v1.4 - #36461

Closed
robobun wants to merge 2 commits into
mainfrom
farm/0c748b1e/cron-tz-docs-note
Closed

robobun wants to merge 2 commits into
mainfrom
farm/0c748b1e/cron-tz-docs-note

Conversation

@robobun

@robobun robobun commented Jul 30, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #28792. Follow-up to #35122.

What

Bun.cron.parse() and the in-process Bun.cron(schedule, handler) switched from UTC to local time in #35122. The Time zone section now describes the new behavior but never mentions that it changed, so a 1.3.x user reading it would assume local time was always the default and miss that their schedules will shift on upgrade.

This adds:

  • A <Note> callout under Time zone in docs/runtime/cron.mdx:

    Prior to Bun v1.4, Bun.cron.parse() and the in-process Bun.cron(schedule, handler) interpreted schedules in UTC. If you're upgrading and relied on that, pass { tz: "UTC" } to keep the previous behavior.

  • A Time zone subsection and @param options on the in-process Bun.cron(schedule, handler, options?) overload JSDoc in bun.d.ts. cron: interpret Bun.cron.parse() and in-process schedules in local time; add { tz } option #35122 added the options parameter to the signature without documenting it, so hovering an existing Bun.cron(expr, fn) call in an editor showed neither the local-time default nor the escape hatch. This closes the asymmetry with parse(), which already documented both.

  • A one-line "prior to v1.4 the default was UTC" on CronOptions.tz.

The v1.3.14 docs stated the UTC behavior explicitly (git show bun-v1.3.14:docs/runtime/cron.mdx line 35: "return the next matching Date in UTC"), so there are shipped releases whose documented semantics differ.

Why docs, not a runtime warning

A one-time stderr warning (first call per process when { tz } is omitted and the process TZ isn't UTC) was considered and rejected:

  • None of the other ~40 breaking changes tracked in List of breaking changes for 1.4 #28792 emit a runtime warning; the 1.4 migration story is changelog + docs + escape hatch, and this change already has all three.
  • Local time is the default for crontab, launchd, Windows Task Scheduler, and the popular npm schedulers (node-cron, croner). A user writing Bun.cron("0 9 * * *", handler) for the first time almost certainly means 9 AM local, so the warning's heuristic can't distinguish "wanted the old UTC behavior" from "wants what every other cron does".
  • The heuristic would fire for essentially every developer outside UTC on every process start, permanently, with no way to silence it other than passing { tz } everywhere.

Verification

  • bunx prettier --check docs/runtime/cron.mdx packages/bun-types/bun.d.ts passes.
  • bun test test/integration/bun-types/bun-types.test.ts passes (14/14).
  • Backtick-wrapped { ... } inside <Note> matches existing usage in docs/runtime/sql.mdx and docs/bundler/hot-reloading.mdx.

Docs-only; no runtime change.

Bun.cron.parse() and the in-process Bun.cron(schedule, handler) changed
from UTC to local time in #35122 as part of the 1.4 breaking changes
(#28792). The Time zone section described the new behavior but never
mentioned that it changed, so users upgrading from 1.3.x had no pointer
to { tz: "UTC" } to restore the old semantics.

Adds a <Note> callout in docs/runtime/cron.mdx and a line in the
CronOptions.tz JSDoc so the migration path is visible in both the
rendered docs and the IDE tooltip.

No runtime warning is added: none of the other ~40 breaking changes in
#28792 warn at runtime, the local-time default matches crontab/launchd/
Task Scheduler and node-cron/croner, and the suggested heuristic (no tz
option, TZ not UTC) would fire for essentially every developer on every
process start with no way to know whether UTC was actually intended.
@robobun
robobun requested a review from alii as a code owner July 30, 2026 13:55
@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@robobun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9a2489b7-9c46-438d-8da6-38a07925d855

📥 Commits

Reviewing files that changed from the base of the PR and between c08f665 and 11c5758.

📒 Files selected for processing (2)
  • docs/runtime/cron.mdx
  • packages/bun-types/bun.d.ts

Comment @coderabbitai help to get the list of available commands.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — docs-only migration note for the v1.4 UTC→local cron time-zone change.

What was reviewed:

  • MDX: backtick-wrapped { tz: "UTC" } inside <Note> matches existing usage (e.g. docs/runtime/sql.mdx, docs/bundler/hot-reloading.mdx), so no MDX/JSX brace-parsing issue.
  • bun.d.ts: JSDoc-only addition on CronOptions.tz; no type surface changed.
  • Claim consistency: surrounding docs and the Bun.cron.parse JSDoc already state local-time default, so the "prior to v1.4" note is additive and non-contradictory.
Extended reasoning...

Overview

Adds a <Note> callout under the Time zone heading in docs/runtime/cron.mdx and one sentence to the CronOptions.tz JSDoc in packages/bun-types/bun.d.ts, both stating that prior to Bun v1.4 cron schedules were interpreted in UTC and that { tz: "UTC" } restores the old behavior. No runtime code is touched.

Security risks

None. Pure documentation/JSDoc; no executable code, no type-surface change, no build-script or config changes.

Level of scrutiny

Low. This is a two-hunk docs change describing a behavior change that already shipped in #35122. The only things worth checking were (a) MDX correctness — curly braces inside JSX children can be parsed as expressions, but here they are inside inline-code backticks, and the same pattern is already used in docs/runtime/sql.mdx, docs/bundler/hot-reloading.mdx, and several other .mdx files; and (b) that the .d.ts edit is comment-only, which it is (verified against the current tz?: string declaration).

Other factors

The PR description confirms prettier --check and the bun-types integration test both pass. The surrounding prose in cron.mdx and the parse() JSDoc already document the local-time default, so the new note is consistent with its neighbors. The bug-hunting system found no issues. There are no prior human review comments to address.

@github-actions

Copy link
Copy Markdown
Contributor

This PR may be a duplicate of:

  1. docs: add Bun 1.3 to 1.4 upgrade guide #36463 - Also documents the Bun.cron UTC-to-local timezone change in v1.4; covers it as part of a broader 1.3→1.4 upgrade guide

🤖 Generated with Claude Code

@robobun

robobun commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author

Not a duplicate of #36463: that PR adds a standalone 1.3→1.4 upgrade guide at docs/project/upgrade-to-1.4.mdx, while this one puts the version note inline in docs/runtime/cron.mdx (the page someone reading about cron time zones actually lands on) and in the CronOptions.tz IDE tooltip. The two touch disjoint files and serve different readers; both can land.

The in-process Bun.cron(schedule, handler, options?) overload JSDoc
never mentioned time zone or its own options parameter, so the one IDE
tooltip an upgrader actually hovers (their existing Bun.cron(expr, fn)
call) carried neither the local-time default nor the v1.4 note.

Adds a Time zone subsection and @PARAM options, mirroring parse().
@robobun

robobun commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author

Docs/JSDoc-only: the diff is a <Note> in docs/runtime/cron.mdx and comment-only additions to packages/bun-types/bun.d.ts (no type surface touched). There is no runtime behavior to fail-before/pass-after; test/integration/bun-types/bun-types.test.ts passes 14/14 and prettier is clean. Ready for review on the diff.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — docs-only version-change note for the cron time-zone default.

What was reviewed:

  • <Note> callout in cron.mdx uses backtick-wrapped { tz: "UTC" } inside JSX children — same pattern already renders in docs/runtime/sql.mdx:198 and docs/bundler/hot-reloading.mdx:55.
  • New @param options and @throws on the in-process overload match the actual signature (options?: CronOptions at bun.d.ts:7737) and the existing prose in cron.mdx ("Throws … if the time-zone name is unknown").
  • CronOptions.tz note is consistent with the parse() JSDoc that already documents the local-zone default.
Extended reasoning...

Overview

Two files touched, both documentation: a <Note> callout added under the Time zone heading in docs/runtime/cron.mdx, and JSDoc additions in packages/bun-types/bun.d.ts (a one-liner on CronOptions.tz, a new ### Time zone subsection + @param options on the in-process Bun.cron(schedule, handler, options?) overload, and an expanded @throws clause covering invalid tz). No runtime code, no .rs/.cpp, no test changes.

Security risks

None. Prose and JSDoc only; nothing executable is modified.

Level of scrutiny

Low. This is a migration note for a behavior change that already landed in #35122. The only correctness concerns are (a) MDX parseability of `{ tz: "UTC" }` inside a JSX <Note> child, and (b) whether the new JSDoc matches the real signature. I verified (a) against identical existing usage in docs/runtime/sql.mdx and docs/bundler/hot-reloading.mdx, and (b) against the overload signature at bun.d.ts:7737, which does take options?: CronOptions. The @throws addition ("options.tz is not a valid IANA name") mirrors the existing prose in cron.mdx ("Throws a TypeError if … the time-zone name is unknown").

Other factors

The PR description reports prettier --check and test/integration/bun-types/bun-types.test.ts passing. The duplicate-PR bot flagged #36463, but that PR touches a separate upgrade-guide file and the author already addressed the overlap. No prior human review comments to resolve. The bug-hunting pass found nothing.

@robobun

robobun commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 8:11 AM PT - Jul 30th, 2026

✅ @robobun, your commit 11c5758a8072e75e2a5a8077fbe54825976290e1 passed in Build #85803! 🎉


🧪   To try this PR locally:

bunx bun-pr 36461

That installs a local version of the PR into your bun-36461 executable, so you can run:

bun-36461 --bun

@github-actions

Copy link
Copy Markdown
Contributor

Closing this PR because it has been inactive for more than 90 days.

@github-actions github-actions Bot closed this Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants