Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex r3): client day keys in configured tz + migration UTC fallback

[._.]/ Adam Eivycaa37faf29e0
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 9bbff29241..3b54f305c2 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -59,7 +59,7 @@
## Fixed
-- **[issue-2681] POST daily status now uses your timezone, not the server's UTC day.** `completedToday`, `todayScore`, and the POST streaks in the MeatSpace POST service derived the day boundary from the server's UTC day (the process runs `TZ=UTC`), so for anyone outside UTC a POST completed the previous local evening could read as "done today," or a just-completed local-day POST could read as incomplete — and the Daily Post widget and the Daily Driver card (#2666), which both render `completedToday` from `getPostStats()`, inherited the drift. The day boundary now threads your configured timezone (`getUserTimezone`/`todayInTimezone`, via a shared `userLocalToday()` helper) through both sides: every writer that stamps a day (`submitPostSession`, `submitTrainingEntry`, and memory-practice logging in `submitPractice`) records a new record's `date` in your local day, and every reader (`getPostStats`/`getPostProgress`/`getUnifiedActivityStreak`/`getTrainingStats`, plus the mastery-window cutoffs) derives "today" in your local day — mirroring the Daily Driver's tz-correct first-visit/handled markers so every surface agrees. All window cutoffs use DST-safe day math off the local today. A one-time migration (`192-post-dates-to-local-timezone`) re-derives existing session and training-log day-strings from each record's stored UTC timestamp in your timezone, so historical streaks stay correct and don't collide with newly-written local-day records; it's a no-op for UTC/unconfigured installs.
+- **[issue-2681] POST daily status now uses your timezone, not the server's UTC day.** `completedToday`, `todayScore`, and the POST streaks in the MeatSpace POST service derived the day boundary from the server's UTC day (the process runs `TZ=UTC`), so for anyone outside UTC a POST completed the previous local evening could read as "done today," or a just-completed local-day POST could read as incomplete — and the Daily Post widget and the Daily Driver card (#2666), which both render `completedToday` from `getPostStats()`, inherited the drift. The day boundary now threads your configured timezone (`getUserTimezone`/`todayInTimezone`, via a shared `userLocalToday()` helper) through both sides: every writer that stamps a day (`submitPostSession`, `submitTrainingEntry`, and memory-practice logging in `submitPractice`) records a new record's `date` in your local day, and every reader (`getPostStats`/`getPostProgress`/`getUnifiedActivityStreak`/`getTrainingStats`, plus the mastery-window cutoffs) derives "today" in your local day — mirroring the Daily Driver's tz-correct first-visit/handled markers so every surface agrees. All window cutoffs use DST-safe day math off the local today. The POST launcher's "completed today"/today's-minutes and the history range floor also derive their day key in your configured timezone (new `useUserTimezone` hook + `dayKeyInTimezone` util) so the client agrees with the server instead of computing "today" in UTC. A one-time migration (`192-post-dates-to-local-timezone`) re-derives existing session and training-log day-strings from each record's stored UTC timestamp in your timezone (preferring the retry-stable `startedAt`), so historical streaks stay correct and don't collide with newly-written local-day records; it falls back to UTC (matching the server's `TZ=UTC` runtime), making it a no-op for UTC/unconfigured installs.
- **[issue-2567] Stop double error toasts across the Settings tabs and the JIRA integration page.** Several Settings surfaces routed a request through the auto-toasting `request()` helper AND showed their own `toast.error` in a custom catch, so a failure stacked two toasts. Every such call now passes `{ silent: true }` so the caller's catch is the single error layer — covering VoiceTab (config load/save, Piper voice download), ImageGenTab (settings/tools load, save, tool register/update, test render), TelegramTab (settings load, method/config/test/disconnect, forward-types), BackupTab (settings load + save), DatabaseTab (status load), EmbeddingsTab (save), MortalLoomTab and CaptionModelPicker (save), and the JIRA instances page (load/save/delete/test — mirroring the DataDog fix from #2520). Loaders and callers without a custom toast are unchanged (single default-helper layer preserved). The `getVoiceConfig`/`updateVoiceConfig`/`fetchPiperVoice`, telegram, `registerTool`/`updateTool`/`getToolsList`, and `getDatabaseStatus` wrappers gained a backward-compatible trailing `options` param so callers can opt into silent. Follow-up sweep of the remaining pipeline/writers-room/universe/media/etc. areas is tracked in #2669.
diff --git a/client/src/components/meatspace/post/PostHistory.jsx b/client/src/components/meatspace/post/PostHistory.jsx
index 840c46a020..3bdace0162 100644
--- a/client/src/components/meatspace/post/PostHistory.jsx
+++ b/client/src/components/meatspace/post/PostHistory.jsx
@@ -6,6 +6,8 @@ import {
} from 'recharts';
import { getPostSessions, getPostStats } from '../../../services/api';
import useChartColors from '../../../hooks/useChartColors.js';
+import useUserTimezone from '../../../hooks/useUserTimezone.js';
+import { dayKeyInTimezone } from '../../../utils/timezone.js';
import { DRILL_TO_DOMAIN, DRILL_LABELS, domainLabel } from './constants';
const RANGES = [
@@ -33,13 +35,18 @@ const scoreColorClass = (score) =>
export default function PostHistory({ onBack }) {
const navigate = useNavigate();
const chartColors = useChartColors();
+ // Configured-timezone day key for the range floor, so the window agrees with
+ // the server's local-day-stamped session dates (issue #2681).
+ const timezone = useUserTimezone();
const [sessions, setSessions] = useState([]);
const [stats, setStats] = useState(null);
const [range, setRange] = useState(30);
const loadData = useCallback(async () => {
+ // Floor the window at the local day `range` days back (configured tz), so it
+ // lines up with the server's local-day session dates rather than a UTC bound.
const from = range > 0
- ? new Date(Date.now() - range * 86400000).toISOString().split('T')[0]
+ ? dayKeyInTimezone(timezone, new Date(Date.now() - range * 86400000))
: undefined;
const [s, st] = await Promise.all([
getPostSessions(from).catch(err => { console.warn('⚠️ Failed to load POST sessions: ' + err.message); return []; }),
@@ -47,7 +54,7 @@ export default function PostHistory({ onBack }) {
]);
setSessions((s || []).slice().reverse());
setStats(st);
- }, [range]);
+ }, [range, timezone]);
useEffect(() => {
loadData();
diff --git a/client/src/components/meatspace/post/PostHistory.test.jsx b/client/src/components/meatspace/post/PostHistory.test.jsx
index 57439718df..46af325e3b 100644
--- a/client/src/components/meatspace/post/PostHistory.test.jsx
+++ b/client/src/components/meatspace/post/PostHistory.test.jsx
@@ -5,6 +5,8 @@ import { MemoryRouter, useLocation } from 'react-router-dom';
vi.mock('../../../services/api', () => ({
getPostSessions: vi.fn(),
getPostStats: vi.fn(),
+ // useUserTimezone (via the range-floor day key) reads getSettings; pin to UTC.
+ getSettings: vi.fn().mockResolvedValue({ timezone: 'UTC' }),
}));
// recharts ResponsiveContainer renders nothing at 0-width in jsdom; the
diff --git a/client/src/components/meatspace/post/PostProgress.test.jsx b/client/src/components/meatspace/post/PostProgress.test.jsx
index a20ee8b3d4..53dfb6d963 100644
--- a/client/src/components/meatspace/post/PostProgress.test.jsx
+++ b/client/src/components/meatspace/post/PostProgress.test.jsx
@@ -7,6 +7,8 @@ vi.mock('../../../services/api', () => ({
// PostHistory (the Sessions sub-view) imports these from the same module.
getPostSessions: vi.fn().mockResolvedValue([]),
getPostStats: vi.fn().mockResolvedValue(null),
+ // PostHistory's useUserTimezone reads getSettings for its range-floor day key.
+ getSettings: vi.fn().mockResolvedValue({ timezone: 'UTC' }),
}));
import PostProgress from './PostProgress';
diff --git a/client/src/components/meatspace/post/PostSessionLauncher.jsx b/client/src/components/meatspace/post/PostSessionLauncher.jsx
index 5a0329a06f..ce306fdfd1 100644
--- a/client/src/components/meatspace/post/PostSessionLauncher.jsx
+++ b/client/src/components/meatspace/post/PostSessionLauncher.jsx
@@ -6,6 +6,8 @@ import { FormField } from '../../ui/FormField';
import { isApiProvider } from '../../../utils/providers';
import { DOMAINS, DRILL_TO_DOMAIN, DRILL_LABELS, computeDomainAverages, computeGoalProgress } from './constants';
import { streakGlyph } from '../../../lib/streakGlyph.js';
+import useUserTimezone from '../../../hooks/useUserTimezone.js';
+import { todayKeyInTimezone } from '../../../utils/timezone.js';
// Canonical domain visiting order for interleaved "Full POST" composition
// (issue #2100): alternate domains — math → cognitive → memory → verbal — so a
@@ -67,6 +69,11 @@ export function buildCleanTags(tags) {
}
export default function PostSessionLauncher({ config, recentSessions, stats, statsWeek, onStart, onViewHistory, onViewConfig, onViewMemory, onViewMorse }) {
+ // Resolve "today" in the user's CONFIGURED timezone so client-side day matching
+ // (completed-today, today's minutes) agrees with the server, which stamps and
+ // windows POST records on the configured local day (issue #2681). Deriving it
+ // from `new Date().toISOString()` (UTC) would disagree near local/UTC midnight.
+ const timezone = useUserTimezone();
const [tags, setTags] = useState({ sleep: '', caffeine: '', stress: '' });
const [mode, setMode] = useState('test'); // 'test' | 'train'
const [providers, setProviders] = useState([]);
@@ -117,19 +124,19 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta
getPostProgress(1, { silent: true })
.then(p => {
if (cancelled) return;
- const t = new Date().toISOString().split('T')[0];
+ const t = todayKeyInTimezone(timezone);
const todayBucket = (p?.series?.byDay || []).find(d => d.date === t);
setTodayMinutesTotal(todayBucket ? todayBucket.minutes : 0);
})
.catch(() => { if (!cancelled) setTodayMinutesTotal(null); });
return () => { cancelled = true; };
- }, [config?.goals?.dailyMinutes]);
+ }, [config?.goals?.dailyMinutes, timezone]);
if (!config) {
return <div className="text-gray-500">Loading configuration...</div>;
}
- const today = new Date().toISOString().split('T')[0];
+ const today = todayKeyInTimezone(timezone);
const todaySession = recentSessions?.find(s => s.date === today);
const lastThree = (recentSessions || []).slice(-3).reverse();
diff --git a/client/src/components/meatspace/post/PostSessionLauncher.test.jsx b/client/src/components/meatspace/post/PostSessionLauncher.test.jsx
index 209a5cf6f1..848c7c8c06 100644
--- a/client/src/components/meatspace/post/PostSessionLauncher.test.jsx
+++ b/client/src/components/meatspace/post/PostSessionLauncher.test.jsx
@@ -10,6 +10,8 @@ vi.mock('../../../services/api', () => ({
getPostRecommendations: vi.fn().mockResolvedValue({ recommendations: [] }),
getMorseProgress: vi.fn().mockResolvedValue({ settings: { wpm: 18, farnsworthWpm: 12 } }),
getPostProgress: vi.fn().mockResolvedValue({ series: { byDay: [] } }),
+ // useUserTimezone (via the today day key) reads getSettings; pin to UTC.
+ getSettings: vi.fn().mockResolvedValue({ timezone: 'UTC' }),
}));
import PostSessionLauncher, { buildCleanTags, cognitiveSummary, interleaveByDomain } from './PostSessionLauncher';
diff --git a/client/src/hooks/README.md b/client/src/hooks/README.md
index e757571323..a00a99e1fd 100644
--- a/client/src/hooks/README.md
+++ b/client/src/hooks/README.md
@@ -62,6 +62,7 @@ grep -i "what you want to do" client/src/hooks/README.md
| `usePreviewRoute` | URL-driven `[preview, setPreview]` via `?preview=<filename>`. | Any page hosting `<MediaPreview>` — gives the preview a deep-link. |
| `useImageGenQueue` | Work-scoped live queue of in-flight image renders. | Pages that show per-work image-gen queue state. |
| `useImageRenderSettings` | Load the pipeline image-gen config once (`getSettings → readPipelineImageSettings`), failing open to `PIPELINE_IMAGE_DEFAULTS`; returns `{ imageCfg }`. | A single-image render slot that needs the render config and doesn't already load the full settings blob. |
+| `useUserTimezone` | Resolve the user's configured IANA timezone (`settings.timezone`) once, falling back to the browser zone then UTC; returns the tz string. | A date-scoped surface that must derive "today" the same way the server does (POST launcher/history day keys, #2681). |
| `useSingleImageRender` | Queue-one-render / wait-for-completion jobId lifecycle: builds opts from `imageCfg`, calls `buildPrompt`, POSTs `generateImage`, tracks the `jobId` head, and runs a once-per-`(key, filename)` completion guard before `onComplete`. | Single-image render slots driven by `EntryThumbSlot`/`MediaJobThumb` (style probe, characters step). Completion SSE stays in the thumb. |
## Sockets & lifecycle
diff --git a/client/src/hooks/index.js b/client/src/hooks/index.js
index d9a9e6fb57..fe4cc0e496 100644
--- a/client/src/hooks/index.js
+++ b/client/src/hooks/index.js
@@ -23,6 +23,7 @@ export { default as useFieldDraft } from './useFieldDraft.js';
export { default as useFocusTrap } from './useFocusTrap.js';
export { default as useImageGenQueue } from './useImageGenQueue.js';
export { default as useImageRenderSettings } from './useImageRenderSettings.js';
+export { default as useUserTimezone } from './useUserTimezone.js';
export { default as useSingleImageRender } from './useSingleImageRender.js';
export { default as useSlotInFlight } from './useSlotInFlight.js';
export { default as useSseJobSlot } from './useSseJobSlot.js';
diff --git a/client/src/hooks/useUserTimezone.js b/client/src/hooks/useUserTimezone.js
new file mode 100644
index 0000000000..cf6664342a
--- /dev/null
+++ b/client/src/hooks/useUserTimezone.js
@@ -0,0 +1,36 @@
+import { useState, useEffect } from 'react';
+import { getSettings } from '../services/api';
+
+/**
+ * Resolve the user's CONFIGURED IANA timezone (`settings.timezone`) once on
+ * mount, so date-scoped POST surfaces derive "today" the same way the server
+ * does (issue #2681). The server stamps and windows POST records on the
+ * configured local day; a client that keyed off `new Date().toISOString()` (UTC)
+ * would disagree around the local/UTC midnight boundary.
+ *
+ * Fallback chain mirrors the server's `getUserTimezone`: configured tz →
+ * browser's own IANA zone (which `useTimezoneBootstrap` in App.jsx seeds into
+ * settings on first load, so the two normally match) → 'UTC'. A transient
+ * settings-fetch failure fails open to the browser zone rather than blocking
+ * render. Starts at the browser zone so the first paint is already close.
+ *
+ * @returns {string} IANA timezone string
+ */
+export default function useUserTimezone() {
+ const browserZone = (() => {
+ try {
+ return Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';
+ } catch {
+ return 'UTC';
+ }
+ })();
+ const [timezone, setTimezone] = useState(browserZone);
+
+ useEffect(() => {
+ getSettings({ silent: true })
+ .then((s) => { if (s?.timezone) setTimezone(s.timezone); })
+ .catch(() => {});
+ }, []);
+
+ return timezone;
+}
diff --git a/client/src/utils/README.md b/client/src/utils/README.md
index a97088499f..7276681a52 100644
--- a/client/src/utils/README.md
+++ b/client/src/utils/README.md
@@ -25,6 +25,7 @@ grep -i "what you want to do" client/src/utils/README.md
| `formatters` | Date/time/duration/byte/word formatters (`formatBytes`, `formatCompactCount`, `timeAgo`, `formatTimecode`, `formatDurationMs`, `formatDateShort`, `parseTimeoutMs`, `formatCooldown`, `parseSizeGb`, `recommendedRamGb`, …) plus timeout-input bounds and `getAppName`. Do not re-define formatters inside components. |
| `cronHelpers` | Cron preset list, `isCronExpression` detection, and `describeCron` human-readable rendering. |
| `timeWindow` | Time-of-day window math (`isInTimeWindow`, `timeStringToMinutes`) and morning-layout auto-switch helpers (`pickActiveLayoutId`, `recordManualLayoutPick`). |
+| `timezone` | Timezone day-key helpers (`dayKeyInTimezone`, `todayKeyInTimezone`) — browser mirror of the server's `todayInTimezone`, so date-scoped POST surfaces derive "today" in the user's configured timezone and agree with the server (#2681). |
## General pure helpers
diff --git a/client/src/utils/index.js b/client/src/utils/index.js
index 3cea0d5e4f..74dcb5b3ae 100644
--- a/client/src/utils/index.js
+++ b/client/src/utils/index.js
@@ -13,6 +13,7 @@
export * from './formatters.js';
export * from './cronHelpers.js';
export * from './timeWindow.js';
+export * from './timezone.js';
// === General pure helpers ===
export * from './coalesce.js';
diff --git a/client/src/utils/timezone.js b/client/src/utils/timezone.js
new file mode 100644
index 0000000000..60b44b29ec
--- /dev/null
+++ b/client/src/utils/timezone.js
@@ -0,0 +1,36 @@
+// Client-side timezone day-key helpers — the browser mirror of the server's
+// `todayInTimezone` (server/lib/timezone.js). POST day-scoped surfaces (the
+// launcher's "completed today", history range bounds) must derive "today" in the
+// user's CONFIGURED timezone so they agree with the server, which now stamps and
+// windows POST records on the configured local day (issue #2681). Deriving the
+// key from `new Date().toISOString()` (UTC) instead would disagree around the
+// local/UTC midnight boundary — showing a just-saved POST as "not yet completed".
+
+/**
+ * `YYYY-MM-DD` for `date` evaluated in `timezone`. `en-CA` formats dates in
+ * ISO `YYYY-MM-DD` order, matching the server's `todayInTimezone` output. An
+ * invalid/empty timezone falls back to the browser's own local day so callers
+ * always get a usable key.
+ * @param {string} timezone - IANA timezone (e.g. 'America/Los_Angeles')
+ * @param {Date} [date] - instant to key (defaults to now)
+ * @returns {string}
+ */
+export function dayKeyInTimezone(timezone, date = new Date()) {
+ const opts = { year: 'numeric', month: '2-digit', day: '2-digit' };
+ try {
+ return new Intl.DateTimeFormat('en-CA', { timeZone: timezone || undefined, ...opts }).format(date);
+ } catch {
+ // Invalid IANA zone → browser-local day (still a valid, usable key).
+ return new Intl.DateTimeFormat('en-CA', opts).format(date);
+ }
+}
+
+/**
+ * Today's `YYYY-MM-DD` in `timezone`. Thin alias over {@link dayKeyInTimezone}
+ * for the common "what's today's key" call.
+ * @param {string} timezone - IANA timezone
+ * @returns {string}
+ */
+export function todayKeyInTimezone(timezone) {
+ return dayKeyInTimezone(timezone, new Date());
+}
diff --git a/client/src/utils/timezone.test.js b/client/src/utils/timezone.test.js
new file mode 100644
index 0000000000..851e8b9ff5
--- /dev/null
+++ b/client/src/utils/timezone.test.js
@@ -0,0 +1,37 @@
+import { describe, it, expect } from 'vitest';
+import { dayKeyInTimezone, todayKeyInTimezone } from './timezone.js';
+
+describe('dayKeyInTimezone', () => {
+ it('returns the local day for an instant whose UTC day is ahead of the local day', () => {
+ // 2026-07-16T05:00Z = 2026-07-15 22:00 PDT — UTC day July 16, LA day July 15.
+ const d = new Date('2026-07-16T05:00:00.000Z');
+ expect(dayKeyInTimezone('America/Los_Angeles', d)).toBe('2026-07-15');
+ expect(dayKeyInTimezone('UTC', d)).toBe('2026-07-16');
+ });
+
+ it('returns the local day for an instant whose local day is ahead of the UTC day', () => {
+ // 2026-07-15T20:00Z = 2026-07-16 05:00 JST — UTC day July 15, Tokyo day July 16.
+ const d = new Date('2026-07-15T20:00:00.000Z');
+ expect(dayKeyInTimezone('Asia/Tokyo', d)).toBe('2026-07-16');
+ expect(dayKeyInTimezone('UTC', d)).toBe('2026-07-15');
+ });
+
+ it('formats as zero-padded YYYY-MM-DD', () => {
+ expect(dayKeyInTimezone('UTC', new Date('2026-01-05T12:00:00.000Z'))).toBe('2026-01-05');
+ });
+
+ it('falls back to the browser-local day for an invalid timezone (never throws)', () => {
+ const d = new Date('2026-07-16T05:00:00.000Z');
+ const browserLocal = new Intl.DateTimeFormat('en-CA', {
+ year: 'numeric', month: '2-digit', day: '2-digit',
+ }).format(d);
+ expect(dayKeyInTimezone('Not/A_Zone', d)).toBe(browserLocal);
+ expect(dayKeyInTimezone('', d)).toBeTruthy();
+ });
+});
+
+describe('todayKeyInTimezone', () => {
+ it('returns today as a YYYY-MM-DD string in the given timezone', () => {
+ expect(todayKeyInTimezone('UTC')).toMatch(/^\d{4}-\d{2}-\d{2}$/);
+ });
+});
diff --git a/scripts/migrations/192-post-dates-to-local-timezone.js b/scripts/migrations/192-post-dates-to-local-timezone.js
index 2f1fb71def..dcb5a5a4e1 100644
--- a/scripts/migrations/192-post-dates-to-local-timezone.js
+++ b/scripts/migrations/192-post-dates-to-local-timezone.js
@@ -55,10 +55,17 @@ async function resolveTimezone(rootDir) {
new Intl.DateTimeFormat('en-CA', { timeZone: tz });
return tz;
} catch {
- // Invalid configured tz — fall through to the process default.
+ // Invalid configured tz — fall through to the guaranteed fallback below.
}
}
- return Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';
+ // Fall back to UTC, NOT the host's system timezone. The runtime server always
+ // runs under `TZ=UTC` (ecosystem.config.cjs), so getUserTimezone()'s own
+ // fallback for an unconfigured install resolves to UTC — and this migration
+ // must match it. `npm run update` can execute this migration OUTSIDE PM2 (where
+ // the host tz would otherwise leak in via Intl's system default) and then
+ // restart under TZ=UTC; keying off the host tz here would permanently rewrite
+ // UTC-dated history that the UTC runtime then reads as local (issue #2681 r3).
+ return 'UTC';
}
// `YYYY-MM-DD` for a UTC instant, evaluated in `timezone`. `en-CA` formats
diff --git a/scripts/migrations/192-post-dates-to-local-timezone.test.js b/scripts/migrations/192-post-dates-to-local-timezone.test.js
index e39d38d11b..2acc71077f 100644
--- a/scripts/migrations/192-post-dates-to-local-timezone.test.js
+++ b/scripts/migrations/192-post-dates-to-local-timezone.test.js
@@ -126,23 +126,17 @@ describe('migration 192 — normalize POST dates to the user local timezone', ()
expect(readJson(sessionsPath)).toEqual(afterFirst);
});
- it('falls back to the process timezone when none is configured', async () => {
- // No settings file → resolves to the runner's own system timezone. Assert the
- // outcome relative to THAT tz so the test is deterministic on any runner: a
- // UTC runner short-circuits (no rewrite); a non-UTC runner re-derives the day.
- const sysTz = Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';
- const instant = '2026-07-16T05:00:00.000Z';
- writeJson(sessionsPath, { sessions: [{ id: 's1', date: '2026-07-16', completedAt: instant }] });
+ it('falls back to UTC (never the host tz) when none is configured, so it is a no-op on any runner', async () => {
+ // No settings file → resolves to UTC, matching the runtime's own TZ=UTC
+ // fallback. This must hold regardless of the runner's system timezone: the
+ // migration can run outside PM2 (via `npm run update`) on a non-UTC host, and
+ // keying off the host tz would rewrite history the UTC runtime reads as local.
+ writeJson(sessionsPath, {
+ sessions: [{ id: 's1', date: '2026-07-16', startedAt: '2026-07-16T05:00:00.000Z' }],
+ });
const result = await migration.up({ rootDir });
- if (sysTz === 'UTC' || sysTz === 'Etc/UTC') {
- expect(result).toEqual({ updated: 0, reason: 'utc-timezone' });
- expect(readJson(sessionsPath).sessions[0].date).toBe('2026-07-16');
- } else {
- const expected = new Intl.DateTimeFormat('en-CA', {
- timeZone: sysTz, year: 'numeric', month: '2-digit', day: '2-digit',
- }).format(new Date(instant));
- expect(readJson(sessionsPath).sessions[0].date).toBe(expected);
- }
+ expect(result).toEqual({ updated: 0, reason: 'utc-timezone' });
+ expect(readJson(sessionsPath).sessions[0].date).toBe('2026-07-16');
});
it('skips a malformed data file without throwing', async () => {