Repository navigation
Give a scheduled task a Time zone, and schedule it in that zone (#3114) - #3208
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 fromIntl.supportedValuesOf('timeZone'), the rule's own zone first andUTCright 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:whenFromFormgives daily/weekly rules thattimeZone, and reads a Once task'sdatetime-localwall 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 existingPick a date and timeinstead of being moved an hour. Opening Edit fills the row from the task's stored zone, andwallClockInputshows 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:
f0c6a78a34a353154649638361cb419e6eef65d1Ran:
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 committedcore/client.js(24855 lines, was 24788).node scripts/ds-bot-patches.mjs check— exit 1 beforegenerate(ok 10 patches apply cleanly in order, thencore/test/schedules-timezone.test.js: committed but not produced by the patchesand fourdiffers from ds-bot/ + patches); after it, exit 0 withok 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, includingcorelint (0 errors) andarch-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/policypath touched.Not run:
1969402c,dirty) at this tip, so the rebase contract is not exercised here. If this cut merges first, Add staged Teamily-style chat tools and owner-scoped history search #3112 rebases and deletes the whole duplicatecore/src/client/schedules.jstime-zone hunk (timeZoneOptions/wallClockInput/instantFromWallClock/whenFromForm, thetimeZonestate, the Time zone row andformStart'sat), thei18n.js'Time zone'line and thetest/schedules-client.test.jsassertion, and re-runsgenerate→check→canonicalsopatches/ds-bot/0001-core-fixes.patchandpatches/ds-bot/files/test/schedules-client.test.jslose their copy (spec §1A). If Add staged Teamily-style chat tools and owner-scoped history search #3112 merges first instead, this cut is void: [#3114] 定时任务表单没有时区:09:00 永远按本机时区,行上写出的时区在编辑框里看不到 #3207 closesnot_planned.instantFromWallClockis asserted to throw for2030-03-10T02:30 @ America/New_Yorkand the form's existingcatchturns that intoPick a date and time, but no real task was created in DSH at a skipped wall clock.main's own open work. No host (core/src/host/**, T2), shared-layer (core/src/shared/**, T3),authz.js,plugins/**,.github/**orpolicy/**line changed.Red first
The three cases ran against the unchanged client sources:
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 takesstart.timeZonebetweenunitandbusy),docs/subsystems/core-client.md(+1/−1) andchangelog.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) andpatches/ds-bot/files/test/schedules-timezone.test.js(new, 137).patches/ds-bot/topics.jsonis 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 regenerates0001/files/rather than hand-editing a patch.