diff --git a/apps/desktop/src/renderer/components/issues/issueDueDatePicker.tsx b/apps/desktop/src/renderer/components/issues/issueDueDatePicker.tsx
index 2d4277ce8e..dab55cb5af 100644
--- a/apps/desktop/src/renderer/components/issues/issueDueDatePicker.tsx
+++ b/apps/desktop/src/renderer/components/issues/issueDueDatePicker.tsx
@@ -4,8 +4,9 @@ import { AnchoredMenu } from "../ui/AnchoredMenu";
import { MENU_SURFACE_CLASS } from "../ui/paneMenuTokens";
import { Z_LAYERS } from "../ui/zLayers";
import { cn } from "../ui/cn";
+import { wallClockAsUtc } from "../../../shared/formatting";
-const DUE_DATE_FORMAT = new Intl.DateTimeFormat(undefined, { month: "short", day: "numeric", year: "numeric" });
+const DUE_DATE_FORMAT = new Intl.DateTimeFormat(undefined, { timeZone: "UTC", month: "short", day: "numeric", year: "numeric" });
function isoDate(date: Date): string {
const year = date.getFullYear();
@@ -66,7 +67,7 @@ export function IssueDueDatePicker({
className="inline-flex h-7 max-w-full items-center gap-1.5 rounded-md border border-fg/[0.08] bg-fg/[0.02] px-2 text-[11.5px] text-fg/85 transition-colors hover:border-fg/[0.16] hover:bg-fg/[0.05] disabled:cursor-default disabled:opacity-70"
>
- {selected ? DUE_DATE_FORMAT.format(selected) : "None"}
+ {selected ? DUE_DATE_FORMAT.format(wallClockAsUtc(selected)) : "None"}
= 10 ? String(Math.round(value)) : value.toFixed(1).replace(/\.0$/u, "");
}
+
+/**
+ * A Date whose UTC fields read the current zone's wall clock. A formatter
+ * pinned to `timeZone: "UTC"` then prints local time while still following a
+ * system time-zone change; one built without a zone would keep the zone it was
+ * constructed in for as long as it is cached. Built from the local calendar
+ * fields rather than an offset, so a historical sub-minute zone offset is not
+ * truncated by `getTimezoneOffset()`.
+ */
+export function wallClockAsUtc(date: Date): Date {
+ const wallClock = new Date(0);
+ wallClock.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());
+ wallClock.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
+ return wallClock;
+}
diff --git a/apps/desktop/src/shared/threadEntities.ts b/apps/desktop/src/shared/threadEntities.ts
index b50b1dc47a..7c6b68ac14 100644
--- a/apps/desktop/src/shared/threadEntities.ts
+++ b/apps/desktop/src/shared/threadEntities.ts
@@ -32,6 +32,7 @@ import { buildDeeplink, type DeeplinkTarget } from "./deeplinks";
import { normalizeJiraIssueKey, jiraIssueRef } from "./issueRefs";
import { getModelById, resolveModelDescriptor } from "./modelRegistry";
import { modelPermissionLabel } from "./modelPermissions";
+import { wallClockAsUtc } from "./formatting";
export type ThreadEntityLane = { id: string; name: string };
export type ThreadEntitySession = { id: string };
@@ -400,10 +401,12 @@ export function linearTeamKeyFromIdentifier(identifier: string | null | undefine
return match ? match[1]!.toUpperCase() : null;
}
-const TIME_SAME_DAY = new Intl.DateTimeFormat(undefined, { hour: "numeric", minute: "2-digit", second: "2-digit" });
-const TIME_OTHER_DAY = new Intl.DateTimeFormat(undefined, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" });
-const TIME_RANGE = new Intl.DateTimeFormat(undefined, { hour: "numeric", minute: "2-digit" });
-const TIME_DAY = new Intl.DateTimeFormat(undefined, { month: "short", day: "numeric" });
+// Pinned to UTC and fed wall-clock-shifted Dates (see wallClockAsUtc): a
+// formatter built without a zone would keep the load-time zone after a change.
+const TIME_SAME_DAY = new Intl.DateTimeFormat(undefined, { timeZone: "UTC", hour: "numeric", minute: "2-digit", second: "2-digit" });
+const TIME_OTHER_DAY = new Intl.DateTimeFormat(undefined, { timeZone: "UTC", month: "short", day: "numeric", hour: "numeric", minute: "2-digit" });
+const TIME_RANGE = new Intl.DateTimeFormat(undefined, { timeZone: "UTC", hour: "numeric", minute: "2-digit" });
+const TIME_DAY = new Intl.DateTimeFormat(undefined, { timeZone: "UTC", month: "short", day: "numeric" });
/**
* A zoned timestamp (or same-day range) in the reader's local time, the one
@@ -418,10 +421,10 @@ export function formatThreadEntityTimestamp(
const date = new Date(epochMs);
const sameDay = new Date(now).toDateString() === date.toDateString();
if (endEpochMs != null) {
- const range = TIME_RANGE.formatRange(date, new Date(endEpochMs));
- return sameDay ? range : `${TIME_DAY.format(date)}, ${range}`;
+ const range = TIME_RANGE.formatRange(wallClockAsUtc(date), wallClockAsUtc(new Date(endEpochMs)));
+ return sameDay ? range : `${TIME_DAY.format(wallClockAsUtc(date))}, ${range}`;
}
- return (sameDay ? TIME_SAME_DAY : TIME_OTHER_DAY).format(date);
+ return (sameDay ? TIME_SAME_DAY : TIME_OTHER_DAY).format(wallClockAsUtc(date));
}
/** Stable identity for "these two chips point at the same thing". */