@devries-cameron20 / t3code-1 / commits / ba32aabf62
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(scheduler): show short server timezone on fixed-time labels (#23111)

Co-authored-by: Shaun Hawk <shawk@fsmeneregy.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Shaun Hawk committed Nov 11, 2026 at 05:30 UTC ba32aabf62e6d33b55656bf8b836d407303a70fe
11 files changed +128 -38
apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx
+10 -4
@@ -38,6 +38,7 @@ import {
38 WEBHOOK_FILTER_OPS,
39 type WebhookFilterDraft,
40 } from "@t3tools/client-runtime/scheduled-task-webhook";
41 +import { scheduleTimeZoneLabel } from "@t3tools/client-runtime/scheduled-task-time-zone";
42 import { useRef, useState, type ReactNode } from "react";
43 import { useFocusEffect, useNavigation, usePreventRemove } from "@react-navigation/native";
44 import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
@@ -117,7 +118,7 @@ const THREAD_MODE_LABELS: Record<ScheduledTaskThreadMode, string> = {
118 fresh_session: "One thread, fresh session",
119 };
120
120 -function describeSchedule(task: ScheduledTask): string {
121 +function describeSchedule(task: ScheduledTask, timeZone?: string): string {
122 if (task.schedule.type === "webhook") return "On webhook";
123 if (task.schedule.type === "once") {
124 const runAt = new Date(task.schedule.runAt);
@@ -125,7 +126,8 @@ function describeSchedule(task: ScheduledTask): string {
126 }
127 if (task.schedule.type === "interval") return formatScheduledTaskInterval(task.schedule.everyMs);
128 const days = task.schedule.weekdays?.length ? repeatLabel(task.schedule.weekdays) : "Every day";
128 - return `${days} at ${formatTime(task.schedule.timeOfDay)}`;
129 + const zone = scheduleTimeZoneLabel(timeZone, task.nextRunAt);
130 + return `${days} at ${formatTime(task.schedule.timeOfDay)}${zone === undefined ? "" : ` ${zone}`}`;
131 }
132
133 function formatTime(value: string): string {
@@ -684,6 +686,7 @@ function TaskForm({
686 draft.task !== null &&
687 tasks.data !== null &&
688 !tasks.data.tasks.some((task) => task.id === draft.task?.id);
689 + const runAtZone = scheduleTimeZoneLabel(tasks.data?.timeZone);
690 const environmentUnavailable = !availableTargets.some(
691 (target) => target.environmentId === environmentId,
692 );
@@ -1058,7 +1061,9 @@ function TaskForm({
1061 <>
1062 <Pressable
1063 accessibilityRole="button"
1061 - accessibilityLabel={`Time, ${formatTime(draft.schedule.timeOfDay)}`}
1064 + accessibilityLabel={`Time, ${formatTime(draft.schedule.timeOfDay)}${
1065 + runAtZone ? ` ${runAtZone}` : ""
1066 + }`}
1067 onPress={() => setTimePickerOpen((open) => !open)}
1068 className="min-h-14 flex-row items-center gap-3 border-t border-border-subtle px-4 py-3 active:opacity-70"
1069 >
@@ -1070,6 +1075,7 @@ function TaskForm({
1075 className="min-w-0 flex-1 text-right text-foreground-muted"
1076 >
1077 {formatTime(draft.schedule.timeOfDay)}
1078 + {runAtZone ? ` ${runAtZone}` : ""}
1079 </Text>
1080 <SymbolView
1081 name="chevron.right"
@@ -1495,7 +1501,7 @@ function EnvironmentTasks({
1501 {task.title}
1502 </Text>
1503 <Text className="text-sm text-foreground-muted" numberOfLines={2}>
1498 - {describeSchedule(task)}
1504 + {describeSchedule(task, tasks.data?.timeZone)}
1505 {!task.enabled
1506 ? " · Paused"
1507 : task.nextRunAt
apps/server/src/scheduledTasks/ScheduledTaskService.ts
+4 -1
@@ -1237,7 +1237,10 @@ export const layer = Layer.effect(
1237
1238 const list: ScheduledTaskService["Service"]["list"] = () =>
1239 listRows().pipe(
1240 - Effect.map((tasks) => ({ tasks })),
1240 + Effect.map((tasks) => ({
1241 + tasks,
1242 + timeZone: DateTime.zoneToString(DateTime.zoneMakeLocal()),
1243 + })),
1244 Effect.mapError((cause) => taskError("Could not list schedule tasks.", { cause })),
1245 );
1246
apps/server/src/ws.ts
+1
@@ -1557,6 +1557,7 @@ export const layerWsRpc = (
1557 currentSession.scopes.includes(AuthOrchestrationOperateScope)
1558 ? result
1559 : {
1560 + ...result,
1561 tasks: result.tasks.map(({ webhook: _webhook, ...task }) => task),
1562 };
1563 const authorizeEffect = <A, E, R>(
apps/web/src/components/chat/ThreadAutomationsPanel.tsx
+10 -5
@@ -16,7 +16,8 @@ import {
16
17 import { ThreadDetailsSection } from "./ThreadDetailsSection";
18 import { cn } from "../../lib/utils";
19 -import { ScheduledRelativeLabel, scheduleLabel } from "../settings/ScheduledTasksSettings";
19 +import { ScheduledRelativeLabel } from "../settings/ScheduledTasksSettings";
20 +import { scheduleLabel } from "../settings/scheduledTasksSettings.logic";
21 import { useEnvironmentQuery } from "../../state/query";
22 import { serverEnvironment } from "../../state/server";
23 import { useAtomCommand } from "../../state/use-atom-command";
@@ -37,10 +38,10 @@ const STATUS_DOT_CLASS: Record<ScheduledTask["lastRunStatus"], string> = {
38 failed: "bg-destructive",
39 };
40
40 -function taskScheduleLine(task: ScheduledTask) {
41 +function taskScheduleLine(task: ScheduledTask, timeZone: string | undefined) {
42 return (
43 <>
43 - {scheduleLabel(task.schedule)}
44 + {scheduleLabel(task.schedule, timeZone, task.nextRunAt)}
45 {task.blockedByPolicy !== undefined ? (
46 ` · ${task.blockedByPolicy}`
47 ) : task.enabled && task.nextRunAt !== null ? (
@@ -179,11 +180,15 @@ export function ThreadAutomationsPanel(props: {
180 <span className="block truncate text-sm font-medium text-foreground/80">
181 {task.title}
182 </span>
182 - <p className="truncate text-2xs text-muted-foreground">{taskScheduleLine(task)}</p>
183 + <p className="truncate text-2xs text-muted-foreground">
184 + {taskScheduleLine(task, tasksQuery.data?.timeZone)}
185 + </p>
186 </TooltipTrigger>
187 <TooltipPopup side="left">
188 <p className="font-medium">{task.title}</p>
186 - <p className="text-muted-foreground">{taskScheduleLine(task)}</p>
189 + <p className="text-muted-foreground">
190 + {taskScheduleLine(task, tasksQuery.data?.timeZone)}
191 + </p>
192 </TooltipPopup>
193 </Tooltip>
194 <Tooltip>
apps/web/src/components/settings/ScheduledTasksSettings.tsx
+19 -28
@@ -21,7 +21,6 @@ import type {
21 ProjectId,
22 ScheduledTask,
23 ScheduledTaskId,
24 - ScheduledTaskSchedule,
24 ScheduledTaskThreadMode,
25 ScheduledTaskUpsertInput,
26 ScheduledTaskWebhookDeliverySummary,
@@ -35,6 +34,7 @@ import {
34 WEBHOOK_FILTER_OPS,
35 type WebhookFilterDraft,
36 } from "@t3tools/client-runtime/scheduled-task-webhook";
37 +import { scheduleTimeZoneLabel } from "@t3tools/client-runtime/scheduled-task-time-zone";
38 import {
39 MAX_WEBHOOK_DELIVERY_AGE_MINUTES,
40 MAX_WEBHOOK_FILTERS,
@@ -104,7 +104,9 @@ import {
104 defaultScheduledTaskProjectId,
105 matchesScheduledTaskScope,
106 scheduleFromDraft,
107 + scheduleLabel,
108 scheduledTaskDefaultModel,
109 + WEEKDAY_LABELS,
110 taskToDraft,
111 unbindDraftFromThread,
112 type DraftState,
@@ -151,7 +153,6 @@ import {
153 } from "./settingsLayout";
154
155 const WEEKDAY_ORDER = [1, 2, 3, 4, 5, 6, 0] as const;
154 -const WEEKDAY_LABELS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] as const;
156 const WEEKDAY_SHORT = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] as const;
157
158 // Thread ids are trimmed, so the leading space keeps this from matching one.
@@ -322,30 +323,6 @@ function splitModelKey(value: string): ModelSelection | null {
323 };
324 }
325
325 -const ONCE_FORMATTER = new Intl.DateTimeFormat(undefined, {
326 - dateStyle: "medium",
327 - timeStyle: "short",
328 -});
329 -
330 -export function scheduleLabel(schedule: ScheduledTaskSchedule): string {
331 - if (schedule.type === "webhook") return "On webhook";
332 - if (schedule.type === "once") return `Once, ${ONCE_FORMATTER.format(new Date(schedule.runAt))}`;
333 - if (schedule.type === "interval") {
334 - const minutes = schedule.everyMs / 60_000;
335 - return Number.isInteger(minutes)
336 - ? `Every ${minutes} min`
337 - : `Every ${Math.round(schedule.everyMs / 1000)} sec`;
338 - }
339 - const weekdays = schedule.weekdays ?? [];
340 - const days =
341 - weekdays.length === 0
342 - ? "Daily"
343 - : weekdays.length === 5 && weekdays.every((day) => day >= 1 && day <= 5)
344 - ? "Weekdays"
345 - : weekdays.map((day) => WEEKDAY_LABELS[day]).join(", ");
346 - return `${days} at ${schedule.timeOfDay}`;
347 -}
348 -
326 /** formatRelativeTime handles only the past; upcoming runs need future labels. */
327 function relativeLabel(value: string | null, nowMs: number): string {
328 if (!value) return "Not scheduled";
@@ -552,6 +529,7 @@ function ScheduledTaskEnvironmentList({
529 return {
530 environment,
531 connected: index >= 0,
532 + timeZone: data?.timeZone,
533 tasks: data?.tasks.filter((task) =>
534 matchesScheduledTaskScope(scope, environment.environmentId, task.projectId),
535 ),
@@ -586,7 +564,7 @@ function ScheduledTaskEnvironmentList({
564
565 return (
566 <SettingsGroup>
589 - {populated.map(({ environment, tasks }) => {
567 + {populated.map(({ environment, tasks, timeZone }) => {
568 const { primary, secondary } = settingsScopeEnvironmentLabels(environment, environments);
569 return (
570 <div key={environment.environmentId} className="divide-y divide-border/50">
@@ -610,6 +588,7 @@ function ScheduledTaskEnvironmentList({
588 key={task.id}
589 environmentId={environment.environmentId}
590 task={task}
591 + timeZone={timeZone}
592 onEdit={() => onEdit(environment.environmentId, task)}
593 />
594 ))}
@@ -734,6 +713,7 @@ function ScheduledTaskEnvironmentSection({
713 key={task.id}
714 environmentId={environment.environmentId}
715 task={task}
716 + timeZone={tasksQuery.data?.timeZone}
717 onEdit={() => onEdit(environment.environmentId, task)}
718 />
719 ))
@@ -747,10 +727,12 @@ function ScheduledTaskEnvironmentSection({
727 function ScheduledTaskRow({
728 environmentId,
729 task,
730 + timeZone,
731 onEdit,
732 }: {
733 readonly environmentId: EnvironmentId;
734 readonly task: ScheduledTask;
735 + readonly timeZone: string | undefined;
736 readonly onEdit: () => void;
737 }) {
738 const canOperate = useAtomValue(
@@ -795,7 +777,7 @@ function ScheduledTaskRow({
777 status={
778 <div className="flex flex-wrap items-center gap-2">
779 <span>
798 - {scheduleLabel(task.schedule)} ·{" "}
780 + {scheduleLabel(task.schedule, timeZone, task.nextRunAt)} ·{" "}
781 {task.blockedByPolicy !== undefined ? (
782 task.blockedByPolicy
783 ) : !task.enabled ? (
@@ -1416,6 +1398,7 @@ function ScheduledTaskEditorForm({
1398 draft.editingId !== null &&
1399 tasksQuery.data !== null &&
1400 !tasksQuery.data.tasks.some((entry) => entry.id === draft.editingId);
1401 + const runAtZone = scheduleTimeZoneLabel(tasksQuery.data?.timeZone);
1402 const liveTask = tasksQuery.data
1403 ? (tasksQuery.data.tasks.find((entry) => entry.id === draft.editingId) ?? null)
1404 : task;
@@ -2063,6 +2046,9 @@ function ScheduledTaskEditorForm({
2046 <Input
2047 type="time"
2048 id="scheduled-task-time"
2049 + aria-describedby={
2050 + runAtZone === undefined ? undefined : "scheduled-task-time-zone"
2051 + }
2052 nativeInput
2053 className="w-32"
2054 value={draft.timeOfDay}
@@ -2070,6 +2056,11 @@ function ScheduledTaskEditorForm({
2056 setDraft((current) => ({ ...current, timeOfDay: event.target.value }))
2057 }
2058 />
2059 + {runAtZone === undefined ? null : (
2060 + <span id="scheduled-task-time-zone" className="text-xs text-muted-foreground">
2061 + {runAtZone}
2062 + </span>
2063 + )}
2064 <span className="text-xs text-muted-foreground">on</span>
2065 </div>
2066 <ToggleGroup
apps/web/src/components/settings/scheduledTasksSettings.logic.test.ts
+10
@@ -22,6 +22,7 @@ import {
22 defaultScheduledTaskProjectId,
23 matchesScheduledTaskScope,
24 scheduleFromDraft,
25 + scheduleLabel,
26 taskToDraft,
27 unbindDraftFromThread,
28 } from "./scheduledTasksSettings.logic";
@@ -407,3 +408,12 @@ it("rejects dedupe templates without a request placeholder", () => {
408 expect(scheduleFromDraft({ ...draft, replayKey: "literal" })).toBeNull();
409 expect(scheduleFromDraft({ ...draft, coalesceKey: "{{body.bad" })).toBeNull();
410 });
411 +
412 +it("appends the server zone only to fixed-time schedule labels", () => {
413 + expect(scheduleLabel({ type: "fixed_time", timeOfDay: "16:31" }, "Etc/UTC")).toBe(
414 + "Daily at 16:31 UTC",
415 + );
416 + expect(scheduleLabel({ type: "fixed_time", timeOfDay: "09:00" })).toBe("Daily at 09:00");
417 + expect(scheduleLabel({ type: "interval", everyMs: 60_000 }, "Etc/UTC")).toBe("Every 1 min");
418 + expect(scheduleLabel({ type: "webhook", signature: null }, "Etc/UTC")).toBe("On webhook");
419 +});
apps/web/src/components/settings/scheduledTasksSettings.logic.ts
+33
@@ -5,6 +5,7 @@ import {
5 type ProjectId,
6 ScheduledTaskId,
7 type ScheduledTask,
8 + type ScheduledTaskSchedule,
9 type ScheduledTaskThreadMode,
10 type ScheduledTaskUpsertSchedule,
11 scheduledTaskThreadMode,
@@ -22,6 +23,7 @@ import {
23 webhookFilterDraftsChanged,
24 type WebhookFilterDraft,
25 } from "@t3tools/client-runtime/scheduled-task-webhook";
26 +import { scheduleTimeZoneLabel } from "@t3tools/client-runtime/scheduled-task-time-zone";
27
28 import {
29 resolveProjectSettings,
@@ -31,6 +33,37 @@ import type { ProviderInstanceEntry } from "../../providerInstances";
33
34 import type { ResolvedSettingsScope } from "./settingsScope";
35
36 +export const WEEKDAY_LABELS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] as const;
37 +
38 +const ONCE_FORMATTER = new Intl.DateTimeFormat(undefined, {
39 + dateStyle: "medium",
40 + timeStyle: "short",
41 +});
42 +
43 +export function scheduleLabel(
44 + schedule: ScheduledTaskSchedule,
45 + timeZone?: string,
46 + runAt?: string | null,
47 +): string {
48 + if (schedule.type === "webhook") return "On webhook";
49 + if (schedule.type === "once") return `Once, ${ONCE_FORMATTER.format(new Date(schedule.runAt))}`;
50 + if (schedule.type === "interval") {
51 + const minutes = schedule.everyMs / 60_000;
52 + return Number.isInteger(minutes)
53 + ? `Every ${minutes} min`
54 + : `Every ${Math.round(schedule.everyMs / 1000)} sec`;
55 + }
56 + const weekdays = schedule.weekdays ?? [];
57 + const days =
58 + weekdays.length === 0
59 + ? "Daily"
60 + : weekdays.length === 5 && weekdays.every((day) => day >= 1 && day <= 5)
61 + ? "Weekdays"
62 + : weekdays.map((day) => WEEKDAY_LABELS[day]).join(", ");
63 + const zone = scheduleTimeZoneLabel(timeZone, runAt);
64 + return `${days} at ${schedule.timeOfDay}${zone === undefined ? "" : ` ${zone}`}`;
65 +}
66 +
67 export function matchesScheduledTaskScope(
68 scope: ResolvedSettingsScope,
69 environmentId: EnvironmentId,
packages/client-runtime/package.json
+4
@@ -83,6 +83,10 @@
83 "types": "./src/scheduledTaskWebhook.ts",
84 "default": "./src/scheduledTaskWebhook.ts"
85 },
86 + "./scheduled-task-time-zone": {
87 + "types": "./src/scheduledTaskTimeZone.ts",
88 + "default": "./src/scheduledTaskTimeZone.ts"
89 + },
90 "./connection": {
91 "types": "./src/connection/index.ts",
92 "default": "./src/connection/index.ts"
packages/client-runtime/src/scheduledTaskTimeZone.test.ts new
+12
@@ -0,0 +1,12 @@
1 +import { expect, it } from "vite-plus/test";
2 +
3 +import { scheduleTimeZoneLabel } from "./scheduledTaskTimeZone.ts";
4 +
5 +it("uses short names instead of full IANA zones", () => {
6 + expect(scheduleTimeZoneLabel(undefined)).toBeUndefined();
7 + expect(scheduleTimeZoneLabel("Unsupported/Zone")).toBeUndefined();
8 + expect(scheduleTimeZoneLabel("Etc/UTC")).toBe("UTC");
9 + expect(scheduleTimeZoneLabel("America/Los_Angeles")).toMatch(/^(PT|Los Angeles Time)$/);
10 + expect(scheduleTimeZoneLabel("America/Los_Angeles", "2027-01-15T17:00:00Z")).toBe("PST");
11 + expect(scheduleTimeZoneLabel("America/Los_Angeles", "2027-07-15T16:00:00Z")).toBe("PDT");
12 +});
packages/client-runtime/src/scheduledTaskTimeZone.ts new
+23
@@ -0,0 +1,23 @@
1 +import * as DateTime from "effect/DateTime";
2 +
3 +/**
4 + * Short label for the server zone a fixed-time schedule runs in. With a run time it names
5 + * that instant's offset (PST/PDT); without one it uses the generic name (PT).
6 + */
7 +export function scheduleTimeZoneLabel(
8 + timeZone: string | undefined,
9 + runAt?: string | null,
10 +): string | undefined {
11 + if (timeZone === undefined) return undefined;
12 + if (timeZone === "Etc/UTC" || timeZone === "UTC" || timeZone === "GMT") return "UTC";
13 + try {
14 + return new Intl.DateTimeFormat("en-US", {
15 + timeZone,
16 + timeZoneName: runAt ? "short" : "shortGeneric",
17 + })
18 + .formatToParts(runAt ? DateTime.toEpochMillis(DateTime.makeUnsafe(runAt)) : undefined)
19 + .find((part) => part.type === "timeZoneName")?.value;
20 + } catch {
21 + return undefined;
22 + }
23 +}
packages/contracts/src/scheduledTask.ts
+2
@@ -271,6 +271,8 @@ export type ScheduledTaskListInput = typeof ScheduledTaskListInput.Type;
271
272 export const ScheduledTaskListResult = Schema.Struct({
273 tasks: ForwardCompatibleArray(ScheduledTask),
274 + /** The server's IANA zone for fixed-time schedules. Absent from older servers. */
275 + timeZone: Schema.optional(TrimmedNonEmptyString),
276 });
277 export type ScheduledTaskListResult = typeof ScheduledTaskListResult.Type;
278