Skip to content

Give a scheduled task a Time zone, and schedule it in that zone (#3114) - #3208

Merged
Birfy merged 1 commit into
mainfrom
dev/3114-schedules-time-zone
Nov 19, 2026
Merged

Birfy merged 1 commit into
mainfrom
dev/3114-schedules-time-zone

Conversation

@Birfy

@Birfy Birfy commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Written-by: Dev
Fixes #3207
Owner: Dev
Reviewer: Reviewer
Part of #3114
Tier: T1

What

The scheduled-task form never showed the zone a rule runs in: Every day at 09:00 always meant this device's zone, and a stored task's own zone (the row prints Every day at 09:00 (Asia/Shanghai)) was invisible in the one place that edits it. The form now draws a Time zone row for Once / Every day / Every week (data-flybot="task-timezone", options from Intl.supportedValuesOf('timeZone'), the rule's own zone first and UTC right after it; a runtime without that API falls back to [UTC, Asia/Shanghai]). Repeat is a duration and draws no row, and a cron rule is kept as stored. The chosen zone is what the form sends: whenFromForm gives daily/weekly rules that timeZone, and reads a Once task's datetime-local wall clock in it (2030-01-02 07:05 @ Asia/Tokyo → 2030-01-01T22:05:00.000Z); a wall clock the zone skips (a DST gap) is refused with the form's existing Pick a date and time instead of being moved an hour. Opening Edit fills the row from the task's stored zone, and wallClockInput shows the Once time in that same zone, so save-without-touching does not move the task.

Checkpoint

{
"pr": 3208,
"claim": "Dev",
"issue": 3207,
"summary": "The scheduled-task form gains a Time zone row for Once, Every day and Every week, listing this runtime's IANA zones with the rule's own zone first. The chosen zone is what the form sends: daily and weekly rules carry it as time_zone, and a Once task's wall clock is read in it. A wall clock the zone skips (a DST gap) is refused with Pick a date and time, not moved an hour. Repeat draws no row and a cron rule is kept as stored; no host, shared-layer or authz file changed.",
"files": [
"core/src/client/schedules.js",
"core/test/schedules-timezone.test.js",
"core/src/client/i18n.js",
"core/test/schedules-client.test.js",
"docs/subsystems/core-client.md",
"changelog.d/3114-scheduled-task-time-zone.added.md",
"core/client.js",
"patches/ds-bot/0001-core-fixes.patch",
"patches/ds-bot/0008-client-bundle.patch",
"patches/ds-bot/files/test/schedules-timezone.test.js"
],
"checks": {
"ran": "TZ=UTC TMPDIR=/data/flybot-tmp npm run verify (exit 0); new file 3/3; four related suites 88/88; node core/scripts/build-client.mjs --check; node scripts/ds-bot-patches.mjs check && canonical; changelog / mojibake / testing-layers checks",
"result": "green",
"at": "f0c6a78a34a353154649638361cb419e6eef65d1"
},
"next": "none — ready for review. T1: a green tests-ok at the tip is the gate; Dev writes no Verdict."
}

Verification at the tip

Tip: f0c6a78a34a353154649638361cb419e6eef65d1

Ran:

  • cd core && TZ=UTC TMPDIR=/data/flybot-tmp node --test test/schedules-timezone.test.js — 3 tests / 0 pass / 3 fail before the change (red first, exact failure lines below), 3 / 3 / 0 after it.
  • cd core && TZ=UTC TMPDIR=/data/flybot-tmp node --test test/schedules-client.test.js test/client-bundle.test.js test/settings-readonly-pages.test.js test/i18n.test.js — 88 tests / 88 pass / 0 fail.
  • node core/scripts/build-client.mjs --check — exit 0 on the committed core/client.js (24855 lines, was 24788).
  • node scripts/ds-bot-patches.mjs check — exit 1 before generate (ok 10 patches apply cleanly in order, then core/test/schedules-timezone.test.js: committed but not produced by the patches and four differs from ds-bot/ + patches); after it, exit 0 with ok core/ equals ds-bot/ + patches/ds-bot/; canonical — generate is a no-op.
  • node .github/scripts/changelog.mjs check — 12 fragments well formed; node .github/scripts/check-mojibake.mjs --check — 0 occurrences of U+FFFD; node .github/scripts/testing-layers.mjs --check — every test file and workflow classified (914 files).
  • TZ=UTC TMPDIR=/data/flybot-tmp npm run verify — exit 0, including core lint (0 errors) and arch-docs.
  • git diff --numstat main -- core/src core/test docs changelog.d — 225 19 6: the six handwritten files, no host / shared / authz / plugins / .github / policy path touched.

Not run:

Red first

The three cases ran against the unchanged client sources:

# tests 3 / # pass 0 / # fail 3
not ok 1 - #3110: the scheduled-task form draws a Time zone control for a rule that carries one, and none for a repeat interval
  error: 'the form draws no Time zone control: ["Send to","Pick a Bot or group chat","B","Name","What to do","When","Once","Every day","Every week","Repeat","Cancel","Create task"]'
not ok 2 - #3110: an edited daily task shows its own zone, saves it, and its row names the same zone
  error: 'the edit form names the zone its task keeps'   (expected: true / operator: '==')
not ok 3 - #3110: a Once task's wall clock is read in the form's zone, not this device's
  error: 'the form converts a wall clock in its zone'   (actual: 'undefined' / expected: 'function')

After the change the same command reports 3 / 3 / 0.

Scope

Six handwritten files (+225/−19): core/src/client/schedules.js (+84/−17), core/test/schedules-timezone.test.js (new, 137), core/src/client/i18n.js (+1), core/test/schedules-client.test.js (+1/−1, the form's state seed list takes start.timeZone between unit and busy), docs/subsystems/core-client.md (+1/−1) and changelog.d/3114-scheduled-task-time-zone.added.md (new, 1). Five generated files: core/client.js (+78/−11, 24788 → 24855), patches/ds-bot/0001-core-fixes.patch (+113/−36), patches/ds-bot/0008-client-bundle.patch (+1031/−956), patches/ds-bot/files/test/schedules-client.test.js (+1/−1) and patches/ds-bot/files/test/schedules-timezone.test.js (new, 137). patches/ds-bot/topics.json is untouched.

Ordering with #3112

#3112 is still open (not merged) at this tip and carries the same schedules.js +96/−17 segment, so the rebase list in Not run above is the contract: whoever lands second deletes the duplicate and regenerates 0001 / files/ rather than hand-editing a patch.

The form had no zone control, so "Every day at 09:00" always meant this
device's zone, and a zone the stored task keeps (the row prints
`Every day at 09:00 (Asia/Shanghai)`) was invisible in the one place that
edits it. A Once task is the same problem the other way round: its
datetime-local wall clock was read in the device's zone, storing an
instant hours away from the zone the form showed.

The form now draws a Time zone row for Once / Every day / Every week,
listing this runtime's IANA zones with the rule's own zone first; Repeat
carries a duration and draws none, and a cron rule is kept as stored. The
chosen zone is what the form sends: daily and weekly rules carry it as
their time_zone, and a Once task's wall clock is read in it, with a wall
clock the zone skips (a DST gap) refused as `Pick a date and time` rather
than silently moved an hour.

Fixes #3207
Part of #3114
@Birfy Birfy added the agent-pr Pull request opened by an agent label Nov 19, 2026
@Birfy Birfy self-assigned this Nov 19, 2026
@Birfy
Birfy marked this pull request as ready for review November 19, 2026 05:52
@Birfy
Birfy added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit c0061ba Nov 19, 2026
22 of 23 checks passed
@Birfy
Birfy deleted the dev/3114-schedules-time-zone branch November 19, 2026 06:13
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Nov 19, 2026
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.

[#3114] 定时任务表单没有时区:09:00 永远按本机时区,行上写出的时区在编辑框里看不到

1 participant