Skip to content

armgit / kwant

Public Imported from GitHub
0

Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.

One clock: every time in the app reads in the device's own format (13c) (#635)

Oleksandr Ivanchenko4a1703ef54ab
diff --git a/frontend/src/agentConnections.ts b/frontend/src/agentConnections.ts
index 30d54db0..ea8cfb1f 100644
--- a/frontend/src/agentConnections.ts
+++ b/frontend/src/agentConnections.ts
@@ -3,6 +3,7 @@
// state while the "copy it now" view is open and nowhere else: not in a list, URL, log or storage.
export type BotScope = 'all' | string[];
+import { dateText, timeText } from './clock';
export interface AgentConnection {
id: string;
@@ -212,10 +213,9 @@ export function listJoin(xs: string[]): string {
return `${xs.slice(0, -1).join(', ')} and ${xs[xs.length - 1]}`;
}
-/** "7 Nov 2026" in the person's zone. */
-export function shortDate(iso: string): string {
- const d = new Date(iso);
- return Number.isNaN(d.getTime()) ? '' : d.toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric' });
+/** "Nov 7, 2026" or "7 Nov 2026": the person's zone and locale. */
+export function shortDate(iso: string, locale?: string): string {
+ return dateText(iso, { locale, year: true }) ?? '';
}
/** "Never", "Just now", "12 min ago", "3 h ago", or a date. */
@@ -245,12 +245,12 @@ export function callLine(c: Pick<AgentCall, 'tool' | 'bot' | 'outcome'>): string
return c.outcome === 'refused' ? `${line}, refused` : line;
}
-/** "00:12" today, else "6 Nov, 23:40". */
-export function callTime(iso: string, now = new Date()): string {
+/** "12:12 AM" today, else "Nov 6, 11:40 PM" (on the device's own clock). */
+export function callTime(iso: string, now = new Date(), locale?: string): string {
const d = new Date(iso);
if (Number.isNaN(d.getTime())) return '';
- const time = d.toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' });
- return d.toDateString() === now.toDateString() ? time : `${d.toLocaleDateString('en-GB', { day: 'numeric', month: 'short' })}, ${time}`;
+ const time = timeText(d, { locale })!;
+ return d.toDateString() === now.toDateString() ? time : `${dateText(d, { locale })}, ${time}`;
}
/** "Claude Code (coding agent)" for a message a coding agent sent, else null (the person's own). */
diff --git a/frontend/src/botActions.ts b/frontend/src/botActions.ts
index fca658b4..f3425cde 100644
--- a/frontend/src/botActions.ts
+++ b/frontend/src/botActions.ts
@@ -4,6 +4,7 @@
import { parseMetaObject } from './questions';
import { Schedule, WEEKDAYS, describeSchedule, formatWhen } from './continuity';
import { PersonCancelledError, personFetch } from './auth';
+import { dateText, timeText } from './clock';
// ---------------------------------------------------------------------------
// Bot actions
@@ -186,12 +187,11 @@ export function scheduleWords(schedule: unknown, scheduleText?: unknown): string
return typeof scheduleText === 'string' && scheduleText ? sentence(scheduleText) : 'Unknown schedule';
}
-/** "once on Fri, Nov 6 at 03:00 PM" in the viewer's own time zone, the way `formatWhen` writes it. */
-export function onceWords(iso: string): string | null {
- const d = new Date(iso);
- if (Number.isNaN(d.getTime())) return null;
- const day = d.toLocaleDateString(undefined, { weekday: 'short', month: 'short', day: 'numeric' });
- const time = d.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });
+/** "once on Fri, Nov 6 at 3:00 PM" in the viewer's own time zone and clock. */
+export function onceWords(iso: string, locale?: string): string | null {
+ const day = dateText(iso, { locale, weekday: true });
+ const time = timeText(iso, { locale });
+ if (!day || !time) return null;
return `once on ${day} at ${time}`;
}
diff --git a/frontend/src/browserPanel.ts b/frontend/src/browserPanel.ts
index 26652e4c..00f6c7b8 100644
--- a/frontend/src/browserPanel.ts
+++ b/frontend/src/browserPanel.ts
@@ -1,5 +1,7 @@
// 0.9.8 browser panel (design browser-panel/design.md D): when the panel closes itself.
+import { timeText } from './clock';
+
export interface PaneOpener {
/** `bot`: a browser event opened it; `person`: a chip, the Bot browser button, a step, a link. */
by: 'bot' | 'person';
@@ -34,7 +36,7 @@ export function paneStatus(s: { running: boolean; finishedAt: string | null; loc
if (s.running) return { kind: 'browsing', text: 'Browsing now' };
if (s.finishedAt) {
const d = new Date(s.finishedAt);
- if (!Number.isNaN(d.getTime())) return { kind: 'finished', text: `Finished ${d.toLocaleTimeString(s.locale ?? [], { hour: 'numeric', minute: '2-digit' })}` };
+ if (!Number.isNaN(d.getTime())) return { kind: 'finished', text: `Finished ${timeText(d, { locale: s.locale })}` };
return { kind: 'finished', text: 'Finished' };
}
return { kind: 'idle', text: 'Idle' };
diff --git a/frontend/src/clock.ts b/frontend/src/clock.ts
index 1570e5b6..f1570c4c 100644
--- a/frontend/src/clock.ts
+++ b/frontend/src/clock.ts
@@ -1,22 +1,94 @@
-// Times as people read them, in this device's time zone: "8:15 PM" today, "Nov 3, 8:15 PM" on
-// another day this year, with the year when it isn't this year.
+// Times as people read them, in this device's locale and time zone: "8:15 PM" today, "Nov 3, 8:15 PM" on
+// another day this year, with the year when it isn't this year. Every time the app shows goes through here
+// (One clock, roadmap 13c): no forced 24 h, no forced en-GB, no hour cycle. The device decides.
+// `locale` is for tests only; the app always passes nothing, which means the device's own.
-const sameDay = (a: Date, b: Date) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
+type When = string | number | Date | null | undefined;
-/** "8:15 PM" when `at` is today, else the date too. Null for a missing or unreadable time. */
-export function localClock(at: string | Date | null | undefined, now: number = Date.now(), locale?: string): string | null {
- if (!at) return null;
+const toDate = (at: When): Date | null => {
+ if (at === null || at === undefined || at === '') return null;
const d = at instanceof Date ? at : new Date(at);
- if (Number.isNaN(d.getTime())) return null;
- const today = new Date(now);
- const time = d.toLocaleTimeString(locale, { hour: 'numeric', minute: '2-digit' });
- if (sameDay(d, today)) return time;
- const date = d.toLocaleDateString(locale, {
+ return Number.isNaN(d.getTime()) ? null : d;
+};
+
+const sameDay = (a: Date, b: Date) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
+
+// The locale's own short time: "8:15 PM" in en-US, "20:15" and "08:30" in en-GB. (`hour: 'numeric'` would write
+// en-GB as "8:30", which is not how a 24-hour device shows it.)
+const TIME = { timeStyle: 'short' } as const;
+
+export interface ClockOpts {
+ locale?: string;
+ /** Only where a screen shows another zone on purpose (missionWatch tests, UTC day buckets). */
+ timeZone?: string;
+}
+
+/** "8:15 PM" in en-US, "20:15" in en-GB. Null for a missing or unreadable time. */
+export function timeText(at: When, opts: ClockOpts = {}): string | null {
+ const d = toDate(at);
+ if (!d) return null;
+ // Some ICU builds (Node 20) put a narrow no-break space before AM/PM; browsers use a plain
+ // space. One space everywhere keeps copy and tests the same on every runtime.
+ return d
+ .toLocaleTimeString(opts.locale, { ...TIME, ...(opts.timeZone ? { timeZone: opts.timeZone } : {}) })
+ .replace(/\u202f/g, ' ');
+}
+
+/** "8:15:02 PM" / "20:15:02": the device's clock with seconds, for step-by-step logs. */
+export function secondsText(at: When, opts: ClockOpts = {}): string | null {
+ const d = toDate(at);
+ if (!d) return null;
+ return d
+ .toLocaleTimeString(opts.locale, { timeStyle: 'medium', ...(opts.timeZone ? { timeZone: opts.timeZone } : {}) })
+ .replace(/\u202f/g, ' ');
+}
+
+/** "Nov 3" / "3 Nov", with the weekday ("Tue, Nov 3") or year ("Nov 3, 2026") when asked. */
+export function dateText(at: When, opts: ClockOpts & { weekday?: boolean; year?: boolean } = {}): string | null {
+ const d = toDate(at);
+ if (!d) return null;
+ return d.toLocaleDateString(opts.locale, {
+ ...(opts.weekday ? { weekday: 'short' } : {}),
month: 'short',
day: 'numeric',
- ...(d.getFullYear() === today.getFullYear() ? {} : { year: 'numeric' }),
+ ...(opts.year ? { year: 'numeric' } : {}),
+ ...(opts.timeZone ? { timeZone: opts.timeZone } : {}),
});
- return `${date}, ${time}`;
+}
+
+/** "Mon, Nov 16, 8:30 AM" in en-US, "Mon 16 Nov, 08:30" in en-GB: a day and time with its weekday. */
+export function weekdayClock(at: When, opts: ClockOpts & { year?: boolean } = {}): string | null {
+ const d = toDate(at);
+ if (!d) return null;
+ return `${dateText(d, { ...opts, weekday: true })}, ${timeText(d, opts)}`;
+}
+
+/** "Nov 3, 8:15 PM" / "3 Nov, 20:15": a date and time, with the year when asked. */
+export function dateClock(at: When, opts: ClockOpts & { year?: boolean } = {}): string | null {
+ const d = toDate(at);
+ if (!d) return null;
+ return `${dateText(d, opts)}, ${timeText(d, opts)}`;
+}
+
+/** "8:15 PM" when `at` is today, else the date too. Null for a missing or unreadable time. */
+export function localClock(at: When, now: number = Date.now(), locale?: string): string | null {
+ const d = toDate(at);
+ if (!d) return null;
+ const today = new Date(now);
+ const time = timeText(d, { locale })!;
+ if (sameDay(d, today)) return time;
+ return `${dateText(d, { locale, year: d.getFullYear() !== today.getFullYear() })}, ${time}`;
+}
+
+/** A stored wall-clock "HH:MM" (a routine's `time`) the way this device writes it: "8:30 AM" in en-US,
+ * "08:30" in en-GB. Anything that isn't HH:MM comes back as it was. */
+export function wallClock(hhmm: string, locale?: string): string {
+ const m = /^(\d{1,2}):(\d{2})$/.exec((hhmm ?? '').trim());
+ if (!m) return hhmm;
+ const h = Number(m[1]);
+ const min = Number(m[2]);
+ if (h > 23 || min > 59) return hhmm;
+ return timeText(new Date(Date.UTC(2000, 0, 3, h, min)), { locale, timeZone: 'UTC' })!;
}
/** A Connections line: "Out of quota until 8:15 PM", or the server's words when there's no time. */
diff --git a/frontend/src/components/Attachments.tsx b/frontend/src/components/Attachments.tsx
index f95219ed..295bb4e8 100644
--- a/frontend/src/components/Attachments.tsx
+++ b/frontend/src/components/Attachments.tsx
@@ -3,6 +3,7 @@ import { createPortal } from 'react-dom';
import { AlertCircle, Download, ExternalLink, FileText, Film, Image as ImageIcon, Loader2, RotateCw, X } from 'lucide-react';
import { POINT_COPY, chipLine, pickName, pickTitle, removeText, rowLine } from '../point';
import { AttachmentRef, PendingUpload, attachKind, attachmentUrl, fileKind, formatBytes, isInlineImage, isVideo, uploadProgressText } from '../attachments';
+import { timeText } from '../clock';
/**
* A file on a message: images as a thumbnail (opens full size), everything else as a tile.
@@ -247,7 +248,7 @@ export const ImageViewer: React.FC<{
const timeLabel = (at: string | null) => {
const t = at ? new Date(at) : null;
- return t && !Number.isNaN(t.getTime()) ? t.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }) : null;
+ return t && !Number.isNaN(t.getTime()) ? timeText(t) : null;
};
/**
diff --git a/frontend/src/components/DailyUsage.tsx b/frontend/src/components/DailyUsage.tsx
index d325ee49..db1d58bb 100644
--- a/frontend/src/components/DailyUsage.tsx
+++ b/frontend/src/components/DailyUsage.tsx
@@ -3,6 +3,7 @@ import { Loader2, RotateCcw } from 'lucide-react';
import { DailyUsage, ModelTotals, compactTokens, formatCost, freshOf, modelUsageApi } from '../modelUsage';
import { type EngineInfo, usageModelLabel } from '../engines';
import { useEngines } from '../useEngines';
+import { dateText } from '../clock';
interface Day {
day: string;
@@ -28,8 +29,8 @@ export function groupDays(rows: DailyUsage[]): Day[] {
return days;
}
-/** "Today", "Yesterday" or "Mon 20 Oct" for a UTC day. */
-export function dayLabel(day: string, now = new Date()): string {
+/** "Today", "Yesterday" or "Mon, Oct 20" / "Mon 20 Oct" for a UTC day, in the device's locale. */
+export function dayLabel(day: string, now = new Date(), locale?: string): string {
const today = now.toISOString().slice(0, 10);
const yesterday = new Date(now.getTime() - 86_400_000).toISOString().slice(0, 10);
if (day === today) return 'Today';
@@ -37,7 +38,7 @@ export function dayLabel(day: string, now = new Date()): string {
const d = new Date(`${day}T00:00:00Z`);
return Number.isNaN(d.getTime())
? day
- : d.toLocaleDateString('en-GB', { weekday: 'short', day: 'numeric', month: 'short', timeZone: 'UTC' });
+ : (dateText(d, { locale, weekday: true, timeZone: 'UTC' }) ?? day);
}
/** The windows the switch offers. */
diff --git a/frontend/src/components/DoneDetail.tsx b/frontend/src/components/DoneDetail.tsx
index df475841..aad57fc1 100644
--- a/frontend/src/components/DoneDetail.tsx
+++ b/frontend/src/components/DoneDetail.tsx
@@ -260,7 +260,7 @@ export const DoneSections: React.FC<{
{trail.length ? (
<ol className="space-y-1.5">
{dropped > 0 && (
- <li className="grid grid-cols-[64px_minmax(0,1fr)] gap-x-2 text-meta text-zinc-400" data-trail-dropped>
+ <li className="grid grid-cols-[5.75rem_minmax(0,1fr)] gap-x-2 text-meta text-zinc-400" data-trail-dropped>
<span aria-hidden="true" />
<span>
{dropped} more {dropped === 1 ? 'step' : 'steps'} before these
@@ -268,8 +268,8 @@ export const DoneSections: React.FC<{
</li>
)}
{trail.map((r, i) => (
- <li key={i} className="grid grid-cols-[64px_minmax(0,1fr)] gap-x-2 text-body" data-trail-row data-status={r.failed ? 'error' : r.skipped ? 'skipped' : 'ok'}>
- <time className="tabular-nums text-meta text-zinc-400 pt-px">{r.at}</time>
+ <li key={i} className="grid grid-cols-[5.75rem_minmax(0,1fr)] gap-x-2 text-body" data-trail-row data-status={r.failed ? 'error' : r.skipped ? 'skipped' : 'ok'}>
+ <time className="tabular-nums whitespace-nowrap text-meta text-zinc-400 pt-px">{r.at}</time>
<span className={`min-w-0 break-words ${r.failed ? 'text-rose-200' : r.skipped ? 'text-zinc-400' : 'text-zinc-100'}`}>
{r.by && (
<>
diff --git a/frontend/src/components/InboxNew.tsx b/frontend/src/components/InboxNew.tsx
index c021621c..981b7f8b 100644
--- a/frontend/src/components/InboxNew.tsx
+++ b/frontend/src/components/InboxNew.tsx
@@ -55,6 +55,7 @@ import {
useInbox,
inboxStore,
} from '../inboxStore';
+import { localClock } from '../clock';
export const WIDE_QUERY = '(min-width: 1024px)';
@@ -112,12 +113,10 @@ const okBtn =
const plainBtn =
'kw-focus inline-flex items-center justify-center gap-1.5 rounded-lg border border-zinc-700 bg-zinc-800/80 text-zinc-100 hover:bg-zinc-700 disabled:opacity-50 disabled:cursor-not-allowed';
-/** "14:08": the queue shows the clock, like the mockups. */
-export function clock(ts: string): string {
- const t = Date.parse(ts);
- if (Number.isNaN(t)) return '';
- const d = new Date(t);
- return `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`;
+/** "2:08 PM" today, "Nov 11, 2:08 PM" another day: the app's one rule, in the device's own format, so the row
+ * reads the same moment the way the card inside it and chat do. */
+export function clock(ts: string, now: number = Date.now()): string {
+ return localClock(ts, now) ?? '';
}
/**
@@ -262,7 +261,7 @@ const QueueRow: React.FC<RowProps> = ({ item, selected, focusable, wide, busy, o
<ModernAvatar role={item.kwant_name} name={item.kwant_name} size={30} kwantId={item.kwant_id} />
<span className="flex-1 min-w-0">
<span className="flex items-center gap-2 text-[11px]">
- <span className="font-semibold text-zinc-300 truncate">
+ <span className="min-w-0 font-semibold text-zinc-300 truncate">
{kicker && (
<span className="font-normal text-zinc-400" data-kicker>
{kicker} ·{' '}
@@ -276,7 +275,7 @@ const QueueRow: React.FC<RowProps> = ({ item, selected, focusable, wide, busy, o
<span className="sr-only">New</span>
</span>
)}
- <time dateTime={item.timestamp} className={`${unread ? '' : 'ml-auto '}shrink-0 tabular-nums text-zinc-400`}>
+ <time dateTime={item.timestamp} className={`${unread ? '' : 'ml-auto '}shrink-0 whitespace-nowrap tabular-nums text-zinc-400`}>
{clock(item.timestamp)}
</time>
</span>
diff --git a/frontend/src/components/ParallelUniverseView.tsx b/frontend/src/components/ParallelUniverseView.tsx
index 436e70f6..00ceaa9e 100644
--- a/frontend/src/components/ParallelUniverseView.tsx
+++ b/frontend/src/components/ParallelUniverseView.tsx
@@ -38,6 +38,7 @@ import {
sourceHost,
validateScenario,
} from '../parallelUniverse';
+import { dateClock } from '../clock';
const TONES: Record<Tone, string> = {
emerald: 'border-emerald-500/30 bg-emerald-500/10 text-emerald-200',
@@ -633,7 +634,7 @@ export const ScenarioDetail: React.FC<{
<select id={runPick} className={`${field} !w-auto max-w-full`} value={current?.run.id ?? ''} onChange={(e) => onPickRun(e.target.value)}>
{runs.map((r) => (
<option key={r.id} value={r.id}>
- {new Date(r.started_at).toLocaleString(undefined, { day: 'numeric', month: 'short', hour: '2-digit', minute: '2-digit' })} · {runStatus(r.status).label}
+ {dateClock(r.started_at) ?? r.started_at} · {runStatus(r.status).label}
</option>
))}
</select>
diff --git a/frontend/src/components/ToolNotesSection.tsx b/frontend/src/components/ToolNotesSection.tsx
index 9a6d7f82..3e2c3323 100644
--- a/frontend/src/components/ToolNotesSection.tsx
+++ b/frontend/src/components/ToolNotesSection.tsx
@@ -22,6 +22,7 @@ import {
toolLabel,
toolNotesApi,
} from '../toolNotes';
+import { timeText } from '../clock';
export type ToolNotesApi = Pick<typeof toolNotesApi, 'list' | 'add' | 'update' | 'remove'>;
@@ -87,14 +88,14 @@ const WhoLine: React.FC<{ n: ToolNote }> = ({ n }) =>
</span>
);
-/** "14:02" today, otherwise relative ("yesterday", "3 days ago"). */
+/** "2:02 PM" today (the device's own clock), otherwise relative ("yesterday", "3 days ago"). */
const shortWhen = (ts: string | null, now: number): string => {
if (!ts) return '';
const t = Date.parse(ts);
if (Number.isNaN(t)) return '';
const d = new Date(t);
const today = new Date(now);
- if (d.toDateString() === today.toDateString()) return d.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit', hour12: false });
+ if (d.toDateString() === today.toDateString()) return timeText(d) ?? '';
return relativeTime(ts, now);
};
diff --git a/frontend/src/components/dev/TicketCard.tsx b/frontend/src/components/dev/TicketCard.tsx
index 54957572..587c2ebc 100644
--- a/frontend/src/components/dev/TicketCard.tsx
+++ b/frontend/src/components/dev/TicketCard.tsx
@@ -10,14 +10,10 @@ import { READ_LABEL, READ_STEPS, closedWhy, earnsMatches, onSite, openQuestions,
import { clock } from '../../dev/logic';
import { SiteOrigins, TicketBrief } from './TicketBrief';
import { TicketQuestions } from './TicketQuestions';
+import { dateText } from '../../clock';
-const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
-/** "Nov 5" in the viewer's zone, or null. */
-export const shortDay = (iso: string | null): string | null => {
- if (!iso) return null;
- const d = new Date(iso);
- return Number.isNaN(d.getTime()) ? null : `${MONTHS[d.getMonth()]} ${d.getDate()}`;
-};
+/** "Nov 5" / "5 Nov" in the viewer's zone and date order, or null. */
+export const shortDay = (iso: string | null): string | null => dateText(iso);
const initials = (name: string) =>
name
diff --git a/frontend/src/continuity.ts b/frontend/src/continuity.ts
index ea991881..990f5205 100644
--- a/frontend/src/continuity.ts
+++ b/frontend/src/continuity.ts
@@ -2,6 +2,7 @@
import type { DeletedSkill, Skill } from './skills';
import type { Recording } from './showOnce';
+import { wallClock, weekdayClock } from './clock';
export const MAX_INSTRUCTIONS = 4000;
export const MAX_MEMORY = 500;
@@ -532,15 +533,15 @@ export function describeSchedule(s: Schedule): string {
case 'once':
return `Once, ${formatWhen(s.at)}`;
case 'daily':
- return `Every day at ${s.time}, ${zoneLabel(s.tz)}`;
+ return `Every day at ${wallClock(s.time)}, ${zoneLabel(s.tz)}`;
case 'weekly':
- return `${weekdaysText(s.weekdays)} at ${s.time}, ${zoneLabel(s.tz)}`;
+ return `${weekdaysText(s.weekdays)} at ${wallClock(s.time)}, ${zoneLabel(s.tz)}`;
case 'interval':
return s.every_minutes % 60 === 0
? `Every ${s.every_minutes / 60} h`
: `Every ${s.every_minutes} min`;
case 'monthly':
- return `Every month on ${monthDaysText(s.days)} at ${s.time}, ${zoneLabel(s.tz)}`;
+ return `Every month on ${monthDaysText(s.days)} at ${wallClock(s.time)}, ${zoneLabel(s.tz)}`;
case 'cron':
return `Custom rule ${s.expression}, ${zoneLabel(s.tz)}`;
default:
@@ -548,11 +549,9 @@ export function describeSchedule(s: Schedule): string {
}
}
-export function formatWhen(iso: string | null): string {
- if (!iso) return '—';
- const d = new Date(iso);
- if (Number.isNaN(d.getTime())) return '—';
- return d.toLocaleString(undefined, { weekday: 'short', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
+/** "Mon, Nov 16, 8:30 AM" on the device's own clock, or "—". */
+export function formatWhen(iso: string | null, locale?: string): string {
+ return weekdayClock(iso, { locale }) ?? '—';
}
/** Time zones for the picker: the browser's list when it has one, with the current value kept. */
diff --git a/frontend/src/dev/jiraSetup.ts b/frontend/src/dev/jiraSetup.ts
index 2462bb4e..03219fc0 100644
--- a/frontend/src/dev/jiraSetup.ts
+++ b/frontend/src/dev/jiraSetup.ts
@@ -13,6 +13,7 @@
import { personFetch } from '../auth';
import { type Ticket, parseTicketList, strList, ticketsNeedCount } from './tickets';
+import { timeText } from '../clock';
const isObj = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v);
const str = (v: unknown, max = 500): string | null => (typeof v === 'string' && v.trim() !== '' ? v.slice(0, max) : null);
@@ -85,10 +86,7 @@ export const rateLimitedText = (retryAt: string | null, fmt: (iso: string) => st
export const matchLine = (n: number): string => (n === 0 ? 'No open tickets match yet.' : `${n} open ${n === 1 ? 'ticket matches' : 'tickets match'} right now`);
export const zeroMatchHelp = (label: string): string => `Add the label ${label} to one in Jira to try it.`;
-export const hhmm = (iso: string): string => {
- const d = new Date(iso);
- return Number.isNaN(d.getTime()) ? '' : `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`;
-};
+export const hhmm = (iso: string): string => timeText(iso) ?? '';
// ---------------------------------------------------------------------------------------------------
// The address: Cloud is known from the host; anything else is asked of the server (a check with no token
diff --git a/frontend/src/dev/logic.ts b/frontend/src/dev/logic.ts
index ac4d0c27..935da236 100644
--- a/frontend/src/dev/logic.ts
+++ b/frontend/src/dev/logic.ts
@@ -13,17 +13,16 @@ import type {
ReviewCard,
RiskLevel,
} from './types';
+import { timeText } from '../clock';
// ---------------------------------------------------------------------------------------------------
// Time and numbers (display only: nothing here computes a new figure from the data)
const pad = (n: number) => String(n).padStart(2, '0');
-/** "19:26" in the viewer's own time zone, or null. */
+/** "7:26 PM" / "19:26" on the viewer's own clock, or null. */
export function clock(iso: string | null): string | null {
- if (!iso) return null;
- const d = new Date(iso);
- return Number.isNaN(d.getTime()) ? null : `${pad(d.getHours())}:${pad(d.getMinutes())}`;
+ return timeText(iso);
}
const dayKey = (d: Date) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
diff --git a/frontend/src/dev/prepush.ts b/frontend/src/dev/prepush.ts
index f485b167..db8c1af9 100644
--- a/frontend/src/dev/prepush.ts
+++ b/frontend/src/dev/prepush.ts
@@ -5,6 +5,7 @@
import { personFetch } from '../auth';
import { DevModeError } from '../devMode';
import { parseFreshEyes, type FreshEyes } from './freshEyes';
+import { timeText } from '../clock';
const isObj = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v);
const str = (v: unknown, max = 2000): string | null => (typeof v === 'string' && v.trim() !== '' ? v.slice(0, max) : null);
@@ -375,9 +376,7 @@ export const requiredPassed = (c: PrepushCard): number => c.checks.filter((k) =>
export function hhmm(ms: number | null): string | null {
if (ms === null) return null;
- const d = new Date(ms);
- if (Number.isNaN(d.getTime())) return null;
- return `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`;
+ return timeText(ms);
}
export function footer(c: PrepushCard, bot: string): string {
diff --git a/frontend/src/dev/worktrees.ts b/frontend/src/dev/worktrees.ts
index db68ea31..529fc6ac 100644
--- a/frontend/src/dev/worktrees.ts
+++ b/frontend/src/dev/worktrees.ts
@@ -3,6 +3,7 @@
// cache per space. Until #486 merges the routes may 404: the tab then says the server doesn't have them yet.
import { personFetch } from '../auth';
+import { dateText, timeText } from '../clock';
export type WorktreeState = 'live' | 'missing' | 'leftover' | 'removed';
@@ -321,12 +322,11 @@ export const worktreeCount = (l: WorktreeList | null): number => (l ? l.repos.re
// ---------------------------------------------------------------------------
// Copy (designs/h1-worktrees.md "Copy (all)")
-const pad = (n: number) => String(n).padStart(2, '0');
-export const hhmm = (d: Date) => `${pad(d.getHours())}:${pad(d.getMinutes())}`;
+export const hhmm = (d: Date) => timeText(d) ?? '';
const DAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
const dayStart = (d: Date) => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
-/** "14:05" today, "yesterday", "Mon" within a week, else "3 Nov". */
+/** "2:05 PM" today, "yesterday", "Mon" within a week, else "Nov 3" (device clock and date order). */
export function dayLabel(iso: string, now: number): { day: string; time: string; today: boolean } {
const d = new Date(iso);
const days = Math.round((dayStart(new Date(now)) - dayStart(d)) / 86_400_000);
@@ -334,7 +334,7 @@ export function dayLabel(iso: string, now: number): { day: string; time: string;
if (days <= 0) return { day: '', time, today: true };
if (days === 1) return { day: 'yesterday', time, today: false };
if (days < 7) return { day: DAYS[d.getDay()], time, today: false };
- return { day: `${d.getDate()} ${d.toLocaleString('en', { month: 'short' })}`, time, today: false };
+ return { day: dateText(d) ?? '', time, today: false };
}
export type Led = 'run' | 'ok' | 'off' | 'warn';
diff --git a/frontend/src/devMode.ts b/frontend/src/devMode.ts
index 09a30d1b..59e6d5eb 100644
--- a/frontend/src/devMode.ts
+++ b/frontend/src/devMode.ts
@@ -3,6 +3,7 @@
// Contract: dev-mode/plan/plan.md §3.2 and §3.6, the route JSON in dev-mode/impl/lin.md.
import { personFetch } from './auth';
+import { dateText, timeText } from './clock';
// ---------------------------------------------------------------------------
// Server shapes
@@ -352,10 +353,9 @@ export interface RepoRow {
fix: ForgeFix | null;
}
-/** "14:32", 24-hour local time: the desk header's "Checked" format, shared by the repo rows. */
+/** "2:32 PM" / "14:32" on the device's clock: the desk header's "Checked" format, shared by the repo rows. */
export function checkedLabel(ms: number): string {
- const d = new Date(ms);
- return `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`;
+ return timeText(ms) ?? '';
}
/** A repo row's poll time in the header's format ("15:30"), or null. */
@@ -1359,15 +1359,15 @@ export const emptyState = (): DevModeState => ({
// ---------------------------------------------------------------------------
// Dev desk
-/** "Today", "Yesterday", or "Tue 3 Nov", in the viewer's local time. */
-export function dayLabel(iso: string, now = new Date()): string {
+/** "Today", "Yesterday", or "Tue, Nov 3" / "Tue 3 Nov", in the viewer's local time and locale. */
+export function dayLabel(iso: string, now = new Date(), locale?: string): string {
const d = new Date(iso);
if (Number.isNaN(d.getTime())) return '';
const day = (x: Date) => new Date(x.getFullYear(), x.getMonth(), x.getDate()).getTime();
const diff = Math.round((day(now) - day(d)) / 86_400_000);
if (diff === 0) return 'Today';
if (diff === 1) return 'Yesterday';
- return d.toLocaleDateString('en-GB', { weekday: 'short', day: 'numeric', month: 'short' });
+ return dateText(d, { locale, weekday: true }) ?? '';
}
/** The day separator goes on the first card of each day, newest first. */
diff --git a/frontend/src/doneAway.ts b/frontend/src/doneAway.ts
index 1e035128..2c81071e 100644
--- a/frontend/src/doneAway.ts
+++ b/frontend/src/doneAway.ts
@@ -10,6 +10,7 @@ import { isReview } from './api/inbox';
import { type Routine, type RoutineRun, type Schedule, WEEKDAYS, monthDaysText } from './continuity';
import { parseMetaObject } from './questions';
import { relativeTime } from './away';
+import { dateText, secondsText, timeText, wallClock } from './clock';
export const NEEDS_GROUPS: InboxGroup[] = ['waiting_on_you', 'failed_or_stuck'];
export const DONE_GROUPS: InboxGroup[] = ['to_review', 'finished'];
@@ -138,32 +139,21 @@ export const doneTitle = (i: InboxItem): string => (isRoutineItem(i) ? routineNa
// ---------- Times ----------
-const pad = (n: number) => String(n).padStart(2, '0');
-/** "22:51", local time; '' for a bad stamp. */
+/** "10:51 PM" / "22:51", the device's own clock; '' for a bad stamp. */
export function hm(ts: string | null | undefined): string {
- const t = Date.parse(ts ?? '');
- if (Number.isNaN(t)) return '';
- const d = new Date(t);
- return `${pad(d.getHours())}:${pad(d.getMinutes())}`;
+ return timeText(ts) ?? '';
}
-/** "22:51:02", local time; '' for a bad stamp. */
+/** "10:51:02 PM" / "22:51:02", the device's own clock; '' for a bad stamp. */
export function hms(ts: string | null | undefined): string {
- const t = Date.parse(ts ?? '');
- if (Number.isNaN(t)) return '';
- const d = new Date(t);
- return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
+ return secondsText(ts) ?? '';
}
-const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
-/** "Nov 11", local date; '' for a bad stamp. */
+/** "Nov 11" / "11 Nov", the device's own date; '' for a bad stamp. */
export function monthDay(ts: string | null | undefined): string {
- const t = Date.parse(ts ?? '');
- if (Number.isNaN(t)) return '';
- const d = new Date(t);
- return `${MONTHS[d.getMonth()]} ${d.getDate()}`;
+ return dateText(ts) ?? '';
}
// ---------- Meta line ----------
@@ -175,15 +165,15 @@ export function scheduleShort(s: Schedule | null | undefined): string {
case 'once':
return 'once';
case 'daily':
- return `every day ${s.time}`;
+ return `every day ${wallClock(s.time)}`;
case 'weekly': {
const days = s.weekdays.length === 7 ? 'day' : s.weekdays.map((d) => WEEKDAYS.find((w) => w.id === d)?.label ?? d).join(', ');
- return `every ${days} ${s.time}`;
+ return `every ${days} ${wallClock(s.time)}`;
}
case 'interval':
return s.every_minutes % 60 === 0 ? `every ${s.every_minutes / 60} h` : `every ${s.every_minutes} min`;
case 'monthly':
- return `monthly on ${monthDaysText(s.days)} ${s.time}`;
+ return `monthly on ${monthDaysText(s.days)} ${wallClock(s.time)}`;
case 'cron':
return 'on a custom rule';
default:
diff --git a/frontend/src/failover.ts b/frontend/src/failover.ts
index 8623a2cd..89dda084 100644
--- a/frontend/src/failover.ts
+++ b/frontend/src/failover.ts
@@ -6,6 +6,7 @@ import type { EngineInfo } from './engines';
import { accountStatus } from './components/EngineAccounts';
import { Engine, Profile, ProfileSwitchedEvent, accountState, activeLimit } from './profiles';
import { parseMetaObject } from './questions';
+import { dateText, timeText } from './clock';
export const FAILOVER_CAPTION = 'When one runs out, kwant bots move to the next that still works, in this order.';
@@ -34,13 +35,13 @@ export function failoverOrder(profiles: Profile[]): Profile[] {
);
}
-/** A clock time in the person's own zone: "03:00", with the weekday or date when it isn't today. */
-export function clockTime(at: Date, now = Date.now()): string {
- const time = at.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit', hour12: false });
+/** A clock time in the person's own zone and format: "3:00 AM" or "03:00", with the weekday or date when it isn't today. */
+export function clockTime(at: Date, now = Date.now(), locale?: string): string {
+ const time = timeText(at, { locale }) ?? '';
const today = new Date(now);
if (at.toDateString() === today.toDateString()) return time;
const days = (at.getTime() - now) / 86400_000;
- const day = days < 6 ? at.toLocaleDateString(undefined, { weekday: 'short' }) : at.toLocaleDateString(undefined, { month: 'short', day: 'numeric' });
+ const day = days < 6 ? at.toLocaleDateString(locale, { weekday: 'short' }) : dateText(at, { locale });
return `${day} ${time}`;
}
diff --git a/frontend/src/goals.ts b/frontend/src/goals.ts
index adc4fb29..79407faa 100644
--- a/frontend/src/goals.ts
+++ b/frontend/src/goals.ts
@@ -7,6 +7,7 @@
import { PersonCancelledError, personFetch } from './auth';
import { MissionError, Tone, ago, checkKindLabel, checkTarget, formatTokens, humanize, missionStatusLabel, missionsApi, stateLabel, untilText } from './missions';
+import { dateText, timeText } from './clock';
export type GoalStatus = 'draft' | 'checking' | 'met' | 'not_met' | 'fixing' | 'unknown' | 'needs_you' | 'paused' | 'waiting';
export type GoalMode = 'watch' | 'suggest' | 'fix';
@@ -932,13 +933,13 @@ export function missionGoalLink(m: { goal_link?: unknown; goal?: unknown }): { i
return null;
}
-/** "21:40" today, "Nov 1, 21:40" before that. */
-export function clockText(iso: string | null, now: number = Date.now()): string | null {
+/** "9:40 PM" in the last 20 h, "Nov 1, 9:40 PM" before that (on the device's own clock). */
+export function clockText(iso: string | null, now: number = Date.now(), locale?: string): string | null {
if (!iso) return null;
const d = new Date(iso);
if (Number.isNaN(d.getTime())) return null;
- const time = d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
- return now - d.getTime() > 20 * 3600_000 ? `${d.toLocaleDateString([], { month: 'short', day: 'numeric' })}, ${time}` : time;
+ const time = timeText(d, { locale })!;
+ return now - d.getTime() > 20 * 3600_000 ? `${dateText(d, { locale })}, ${time}` : time;
}
// ---------------------------------------------------------------------------
diff --git a/frontend/src/h4Status.ts b/frontend/src/h4Status.ts
index ca8ecc40..2c7fc45e 100644
--- a/frontend/src/h4Status.ts
+++ b/frontend/src/h4Status.ts
@@ -2,6 +2,7 @@
// here only reads what H5 and H3 need: `stuck` for the attention order's rank 2, the turn start for
// "running longest first", `held` for the line under a held message, and Try again.
import { personFetch } from './auth';
+import { timeText } from './clock';
export type H4StatusKind = 'working' | 'queued' | 'needs_you' | 'quiet' | 'stuck' | 'paused' | 'available';
@@ -98,10 +99,7 @@ export const h4Api = {
},
};
-const hhmm = (iso?: string): string | null => {
- const t = iso ? Date.parse(iso) : NaN;
- return Number.isFinite(t) ? new Date(t).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false }) : null;
-};
+const hhmm = (iso?: string): string | null => timeText(iso);
export const isGaveUp = (s?: H4Status | null): boolean => s?.status === 'stuck' && s.reason_code === 'stalled_gave_up';
diff --git a/frontend/src/kwantMood.ts b/frontend/src/kwantMood.ts
index 9fd2439d..9200d3a4 100644
--- a/frontend/src/kwantMood.ts
+++ b/frontend/src/kwantMood.ts
@@ -6,6 +6,7 @@
import { isKwantWorking, subscribeKwant } from './kwantActivity';
import { parsePick } from './engines';
import { activeLimit, type Profile } from './profiles';
+import { timeText } from './clock';
export type Mood = 'resting' | 'needs_you' | 'thinking' | 'working' | 'failed' | 'finished' | 'idle';
@@ -43,10 +44,9 @@ export function selectMood(i: MoodInputs): Mood {
return 'idle';
}
-const pad = (n: number) => String(n).padStart(2, '0');
-/** "03:00" in the person's zone, with the day when it isn't today. */
+/** "3:00 AM" / "03:00" on the device's clock, with the day when it isn't today. */
export function restingClock(at: Date, now = Date.now()): string {
- const time = `${pad(at.getHours())}:${pad(at.getMinutes())}`;
+ const time = timeText(at) ?? '';
return at.toDateString() === new Date(now).toDateString() ? time : `${at.toLocaleDateString(undefined, { weekday: 'short' })} ${time}`;
}
diff --git a/frontend/src/letters.ts b/frontend/src/letters.ts
index 7df1a453..4f4c532d 100644
--- a/frontend/src/letters.ts
+++ b/frontend/src/letters.ts
@@ -6,6 +6,7 @@
import { LooseCase, LooseEndsError, call, shortDate } from './looseEnds';
import { MAX_ATTACHMENT_BYTES } from './attachments';
+import { dateClock } from './clock';
export interface LetterField {
value: string;
@@ -219,7 +220,7 @@ export const reminderLabel = (offset: number): string => (offset === 0 ? 'On the
export const reminderWhen = (iso: string): string => {
const d = new Date(iso);
- return Number.isNaN(d.getTime()) ? iso : d.toLocaleString(undefined, { day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' });
+ return Number.isNaN(d.getTime()) ? iso : (dateClock(d, { year: true }) ?? iso);
};
/** Text for a refused upload of a letter: busy reads calmly, the rest says what to change. */
diff --git a/frontend/src/missionWatch.ts b/frontend/src/missionWatch.ts
index c53d3a51..9056f3ab 100644
--- a/frontend/src/missionWatch.ts
+++ b/frontend/src/missionWatch.ts
@@ -11,6 +11,7 @@
import { PersonCancelledError, personFetch } from './auth';
import { parseMetaObject } from './questions';
import type { Mission } from './missions';
+import { timeText } from './clock';
export type WatchState =
| 'off'
@@ -313,12 +314,9 @@ export function parseCandidates(raw: unknown): WatchCandidate[] {
// ---------- Times ----------
-/** 24-hour HH:MM in the person's zone (or the one given, for tests). */
-export function hm(at: string | null | undefined, timeZone?: string): string {
- if (!at) return '';
- const d = new Date(at);
- if (!Number.isFinite(d.getTime())) return '';
- return new Intl.DateTimeFormat('en-GB', { hour: '2-digit', minute: '2-digit', hourCycle: 'h23', ...(timeZone ? { timeZone } : {}) }).format(d);
+/** A clock time on the device's own clock, in the person's zone (or the one given, for tests). */
+export function hm(at: string | null | undefined, timeZone?: string, locale?: string): string {
+ return timeText(at, { timeZone, locale }) ?? '';
}
// ---------- Order and rows ----------
diff --git a/frontend/src/point.ts b/frontend/src/point.ts
index 12859bf7..8fb147ed 100644
--- a/frontend/src/point.ts
+++ b/frontend/src/point.ts
@@ -4,6 +4,7 @@
/** Every point error carries one of these; route on it, never on the error text. */
export type PointCode = 'nothing' | 'stale' | 'loading' | 'failed' | 'bad_request';
+import { timeText } from './clock';
const CODES: ReadonlySet<string> = new Set(['nothing', 'stale', 'loading', 'failed', 'bad_request']);
export interface PointBox {
@@ -257,11 +258,9 @@ export function chipLine(p: { picture: boolean; host: string; path: string; fram
return `${p.host}${p.path}`;
}
-/** HH:MM in the viewer's local time, or '' for a bad time. */
+/** A clock time in the viewer's local time and format, or '' for a bad time. */
export function clockText(at: string, locale?: string): string {
- const t = at ? new Date(at) : null;
- if (!t || Number.isNaN(t.getTime())) return '';
- return t.toLocaleTimeString(locale ?? [], { hour: '2-digit', minute: '2-digit', hour12: false });
+ return timeText(at, { locale }) ?? '';
}
/** The bubble row's second line: `{host}{path} · W × H · HH:MM`. */
diff --git a/frontend/src/profiles.ts b/frontend/src/profiles.ts
index dde78d1d..f7f795b4 100644
--- a/frontend/src/profiles.ts
+++ b/frontend/src/profiles.ts
@@ -1,6 +1,7 @@
// LLM profiles: one account per engine (a work and a personal Claude, say). Keys are write-only.
export type Engine = 'claude' | 'codex' | 'grok' | 'custom';
+import { dateClock, timeText } from './clock';
export type ProfileKind = 'system' | 'cli_home' | 'api_key' | 'custom_api';
/** How a Custom API account's server talks: OpenAI chat completions or Anthropic Messages. */
@@ -169,7 +170,7 @@ export function formatUntil(at: Date, now = Date.now()): string {
if (mins < 60) return `in ${mins} min`;
const hours = Math.round(mins / 60);
if (hours < 24) return `in ${hours} h`;
- return at.toLocaleString(undefined, { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
+ return dateClock(at) ?? '';
}
/** Below this much left, a limit's bar and the avatar badge turn amber (account-usage design §2.2). */
@@ -199,7 +200,7 @@ export interface UsageRow {
export const hasUsageLimits = (p: Pick<Profile, 'engine' | 'kind'>) => (p.engine === 'claude' || p.engine === 'codex') && (p.kind === 'system' || p.kind === 'cli_home');
/** A time on the person's own clock: "22:29" or "10:29 PM". */
-const clockOf = (at: Date) => at.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' });
+const clockOf = (at: Date) => timeText(at) ?? '';
const sameDay = (a: Date, b: Date) => a.toDateString() === b.toDateString();
const weekday = (at: Date) => at.toLocaleDateString(undefined, { weekday: 'short' });
diff --git a/frontend/src/reviewItem.ts b/frontend/src/reviewItem.ts
index 7fea3595..e21689fc 100644
--- a/frontend/src/reviewItem.ts
+++ b/frontend/src/reviewItem.ts
@@ -7,6 +7,7 @@ import type { CriterionStatus, InboxItem, ReviewItem, VerdictResult } from './ap
import { VERDICT_WORD } from './api/inbox';
import type { RestorePreview, RestoreResult } from './missions';
import { TIER_LABELS } from './flightSchool';
+import { localClock } from './clock';
/** What the item view hands back when an action is done (Pixel's pane removes the item, opens the next). */
export interface ReviewDone {
@@ -43,12 +44,10 @@ export function validReviewItem(i: InboxItem | null | undefined): i is ReviewIte
return isArr(i.criteria) && isArr(i.couldnt_verify) && isArr(i.held_actions) && !!i.risk;
}
-/** "14:41" in the person's own clock, or null for a missing or bad time. */
-export function clock(iso: string | null | undefined): string | null {
- if (!iso) return null;
- const d = new Date(iso);
- if (Number.isNaN(d.getTime())) return null;
- return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false });
+/** "2:41 PM" / "14:41" today, "Nov 11, 2:41 PM" another day, on the person's own clock; null for a missing or
+ * bad time. A review that started yesterday must not say "since 9:05 AM". */
+export function clock(iso: string | null | undefined, locale?: string, now: number = Date.now()): string | null {
+ return localClock(iso ?? null, now, locale);
}
/** "Needs you · medium confidence"'s second half, or null (no verdict, or no confidence). */
diff --git a/frontend/src/teams/teamTemplates.ts b/frontend/src/teams/teamTemplates.ts
index f2144265..bab60da0 100644
--- a/frontend/src/teams/teamTemplates.ts
+++ b/frontend/src/teams/teamTemplates.ts
@@ -3,6 +3,7 @@
// next-077/api.md (Lin, branch lin-077-teams). The client turns api.md's shapes into the ones below;
// tests and shots run against the wire-format fixtures in templateFixtures.ts and suggestFixtures.ts.
import { personFetch } from '../auth';
+import { timeText } from '../clock';
// ---------------------------------------------------------------------------------------------------
// Types. The internal shapes the sheet uses; `Wire*` are api.md's, turned into these by the client.
@@ -213,11 +214,7 @@ export function needProblem(raw: string): string | null {
export const NEED_FAILED = 'Couldn’t suggest a team this time. Try again, or start from a ready-made team.';
/** A time from the server (`until`, RFC 3339) as the person's clock time, or null. */
-const clock = (v: unknown): string | null => {
- if (typeof v !== 'string') return null;
- const d = new Date(v);
- return Number.isFinite(d.getTime()) ? d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) : null;
-};
+const clock = (v: unknown): string | null => (typeof v === 'string' ? timeText(v) : null);
/**
* What a failed need suggestion says: { head, reason }. `head` is the brief's line; `reason` is the
diff --git a/frontend/src/telegram.ts b/frontend/src/telegram.ts
index e103fbeb..e1d8533c 100644
--- a/frontend/src/telegram.ts
+++ b/frontend/src/telegram.ts
@@ -3,6 +3,7 @@
// fetch wrapper adds `?space=`). The token is never returned by any route, so nothing here holds it
// after the PUT that saves it.
import { personFetch } from './auth';
+import { timeText } from './clock';
export type TelegramState = 'off' | 'token_saved' | 'pairing' | 'paired' | 'rejected';
export type TelegramPoll = 'listening' | 'offline' | 'throttled';
@@ -184,11 +185,8 @@ export function qrSource(svg: string): string | null {
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`;
}
-/** A clock time, "10:04", in the person's locale. */
-export const hhmm = (iso: string | null): string | null => {
- const t = iso ? Date.parse(iso) : NaN;
- return Number.isFinite(t) ? new Date(t).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) : null;
-};
+/** A clock time, "10:04 AM" or "10:04", on the device's own clock. */
+export const hhmm = (iso: string | null, locale?: string): string | null => timeText(iso, { locale });
/** "Nov 7". */
export const shortDate = (iso: string | null): string | null => {
const t = iso ? Date.parse(iso) : NaN;
diff --git a/frontend/tests/botActions.test.mjs b/frontend/tests/botActions.test.mjs
index 23c491da..6ab352ca 100644
--- a/frontend/tests/botActions.test.mjs
+++ b/frontend/tests/botActions.test.mjs
@@ -47,7 +47,7 @@ test('applied routine card: summary, routine facts, Undo, Edit and Pause', () =>
const t = text(html);
assert.match(t, /Coach set up a routine/);
assert.match(t, /Created routine 'Morning motivation'/);
- assert.match(t, /When Every day at 07:00, Berlin time/);
+ assert.match(t, /When Every day at 7:00 AM, Berlin time/);
assert.match(t, /Runs as Coach/);
assert.match(t, /Posts in #general/);
assert.match(t, /Next run/);
@@ -138,7 +138,7 @@ test('non-routine actions: no routine facts, verb fallback', () => {
});
test('schedules in words: ours for known shapes, the server text otherwise', () => {
- assert.equal(b.scheduleWords({ type: 'monthly', time: '09:00', days: [1, 'last'], tz: 'UTC' }), 'Every month on the 1st and last day at 09:00, UTC');
+ assert.equal(b.scheduleWords({ type: 'monthly', time: '09:00', days: [1, 'last'], tz: 'UTC' }), 'Every month on the 1st and last day at 9:00 AM, UTC');
assert.equal(b.scheduleWords({ type: 'cron', expression: '0 9 * * MON#2', tz: 'UTC' }), 'Custom rule 0 9 * * MON#2, UTC');
assert.equal(b.scheduleWords({ type: 'lunar' }, 'when the moon is full'), 'When the moon is full');
assert.equal(b.scheduleWords(null, ''), 'Unknown schedule');
@@ -343,7 +343,7 @@ test('a follow-up card says when it runs in local words, never the raw ISO time'
assert.doesNotMatch(shown, /2026-11-06T|14:00:00Z/, shown);
const d = new Date(at);
const day = d.toLocaleDateString(undefined, { weekday: 'short', month: 'short', day: 'numeric' });
- const time = d.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });
+ const time = d.toLocaleTimeString(undefined, { timeStyle: 'short' }).replace(/\u202f/g, ' ');
assert.match(shown, new RegExp(`once on ${day} at ${time}`), shown);
assert.equal(b.summaryText(b.parseBotActionMeta(meta)), `scheduled a follow-up 'Follow-up: check the deploy', once on ${day} at ${time}, in the thread "Deploy"`);
// A summary whose schedule we can't read stays as the server wrote it.
diff --git a/frontend/tests/browserPanelClose.test.mjs b/frontend/tests/browserPanelClose.test.mjs
index 48d96cff..82a6684a 100644
--- a/frontend/tests/browserPanelClose.test.mjs
+++ b/frontend/tests/browserPanelClose.test.mjs
@@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import test from 'node:test';
import ts from 'typescript';
+import { loadBundled } from './bundle.mjs';
// 0.9.8 browser panel (design browser-panel/design.md D): the panel closes itself only when a bot opened it.
const load = async (path) => {
@@ -9,7 +10,7 @@ const load = async (path) => {
const { outputText } = ts.transpileModule(source, { compilerOptions: { module: ts.ModuleKind.ESNext, target: ts.ScriptTarget.ES2022 } });
return import(`data:text/javascript;base64,${Buffer.from(outputText).toString('base64')}`);
};
-const { shouldAutoClose, shouldAutoOpen, paneStatus, AUTO_CLOSE_DELAY_MS } = await load('../src/browserPanel.ts');
+const { shouldAutoClose, shouldAutoOpen, paneStatus, AUTO_CLOSE_DELAY_MS } = await loadBundled("export * from './src/browserPanel.ts';") // imports clock.ts, so it's bundled;
const ended = { by: 'bot', touched: false, control: false, humanStep: false, pointPending: false, running: false };
diff --git a/frontend/tests/codingAgents.test.mjs b/frontend/tests/codingAgents.test.mjs
index c0d9edb9..790f5b51 100644
--- a/frontend/tests/codingAgents.test.mjs
+++ b/frontend/tests/codingAgents.test.mjs
@@ -165,7 +165,7 @@ test('a row: name, spaces and bots, the added date, and "Never" before first use
const t = text(m.row({ c: conn(), now: Date.parse('2026-11-07T01:00:00Z') }));
assert.ok(t.includes('Claude Code'));
assert.ok(t.includes('Work · All bots'));
- assert.ok(t.includes('Added 7 Nov 2026'));
+ assert.ok(t.includes('Added Nov 7, 2026'));
assert.ok(t.includes('Last used Never'));
assert.ok(t.includes('Revoke'));
assert.ok(t.includes('Recent activity'));
diff --git a/frontend/tests/continuity.test.mjs b/frontend/tests/continuity.test.mjs
index f703e129..a2bef3f9 100644
--- a/frontend/tests/continuity.test.mjs
+++ b/frontend/tests/continuity.test.mjs
@@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import test from 'node:test';
import ts from 'typescript';
+import { loadBundled } from './bundle.mjs';
const load = async (path) => {
const source = await readFile(new URL(path, import.meta.url), 'utf8');
@@ -9,7 +10,7 @@ const load = async (path) => {
return import(`data:text/javascript;base64,${Buffer.from(outputText).toString('base64')}`);
};
-const c = await load('../src/continuity.ts');
+const c = await loadBundled("export * from './src/continuity.ts';") // imports clock.ts, so it's bundled;
test('snippets escape everything except <mark>', () => {
const raw = 'see <script>alert("x")</script> & <b>the</b> <mark>plan</mark> <img src=x onerror=alert(1)>';
@@ -196,7 +197,7 @@ test('monthly and cron schedules in plain words', () => {
assert.equal(c.monthDaysText([15, 'last', 1]), 'the 1st, 15th and last day');
assert.equal(c.monthDaysText([2, 3, 11, 12, 13, 21, 22, 23]), 'the 2nd, 3rd, 11th, 12th, 13th, 21st, 22nd and 23rd');
assert.equal(c.monthDaysText(['last']), 'the last day');
- assert.equal(c.describeSchedule({ type: 'monthly', time: '09:00', days: [1], tz: 'UTC' }), 'Every month on the 1st at 09:00, UTC');
+ assert.equal(c.describeSchedule({ type: 'monthly', time: '09:00', days: [1], tz: 'UTC' }), 'Every month on the 1st at 9:00 AM, UTC');
assert.equal(c.describeSchedule({ type: 'cron', expression: '0 9 * * MON#2', tz: 'UTC' }), 'Custom rule 0 9 * * MON#2, UTC');
assert.equal(c.describeSchedule({ type: 'lunar' }), 'Unknown schedule');
});
@@ -245,14 +246,14 @@ test('sameDays: the Weekdays chip is on only for exactly Mon–Fri', () => {
test('describeSchedule writes the zone as a city and names common day sets', () => {
const w = (weekdays) => c.describeSchedule({ type: 'weekly', time: '09:00', weekdays, tz: 'Europe/Kyiv' });
- assert.equal(c.describeSchedule({ type: 'daily', time: '09:00', tz: 'Europe/Kyiv' }), 'Every day at 09:00, Kyiv time');
- assert.equal(w(['mon']), 'Every Monday at 09:00, Kyiv time');
- assert.equal(w(['fri', 'mon', 'wed']), 'Mon, Wed and Fri at 09:00, Kyiv time');
- assert.equal(w(['mon', 'tue', 'wed', 'thu', 'fri']), 'Weekdays at 09:00, Kyiv time');
- assert.equal(w(['sat', 'sun']), 'Weekends at 09:00, Kyiv time');
- assert.equal(w(['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']), 'Every day at 09:00, Kyiv time');
- assert.equal(w(['tue', 'thu']), 'Tue and Thu at 09:00, Kyiv time');
- assert.equal(c.describeSchedule({ type: 'monthly', time: '07:00', days: [1], tz: 'Europe/Kyiv' }), 'Every month on the 1st at 07:00, Kyiv time');
+ assert.equal(c.describeSchedule({ type: 'daily', time: '09:00', tz: 'Europe/Kyiv' }), 'Every day at 9:00 AM, Kyiv time');
+ assert.equal(w(['mon']), 'Every Monday at 9:00 AM, Kyiv time');
+ assert.equal(w(['fri', 'mon', 'wed']), 'Mon, Wed and Fri at 9:00 AM, Kyiv time');
+ assert.equal(w(['mon', 'tue', 'wed', 'thu', 'fri']), 'Weekdays at 9:00 AM, Kyiv time');
+ assert.equal(w(['sat', 'sun']), 'Weekends at 9:00 AM, Kyiv time');
+ assert.equal(w(['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']), 'Every day at 9:00 AM, Kyiv time');
+ assert.equal(w(['tue', 'thu']), 'Tue and Thu at 9:00 AM, Kyiv time');
+ assert.equal(c.describeSchedule({ type: 'monthly', time: '07:00', days: [1], tz: 'Europe/Kyiv' }), 'Every month on the 1st at 7:00 AM, Kyiv time');
assert.equal(c.describeSchedule({ type: 'cron', expression: '0 9 * * MON#2', tz: 'Europe/Kyiv' }), 'Custom rule 0 9 * * MON#2, Kyiv time');
assert.equal(c.describeSchedule({ type: 'interval', every_minutes: 120 }), 'Every 2 h');
});
diff --git a/frontend/tests/devAnyGit.test.mjs b/frontend/tests/devAnyGit.test.mjs
index 5745c17e..1757b479 100644
--- a/frontend/tests/devAnyGit.test.mjs
+++ b/frontend/tests/devAnyGit.test.mjs
@@ -84,7 +84,7 @@ test('provider beats the host guess: a GitHub Enterprise host the server calls g
assert.equal(m.gitOnlyRepo(s, 'ghe.example.test/demo/core'), false);
assert.equal(m.statusLine(s).note, null, 'no plain-git line');
assert.deepEqual(texts(m.statusLine(s).parts), ['Watching ', 'demo/core', ' · ', 'main']);
- assert.equal(m.repoRows(state({ repos: [APP, GHE] }))[1].state, 'Watching · checked 09:00');
+ assert.equal(m.repoRows(state({ repos: [APP, GHE] }))[1].state, 'Watching · checked 9:00 AM');
// The same row from an older server is guessed as plain git.
assert.ok(m.gitOnlyRepo(state({ repos: [noProvider(GHE)] }), 'ghe.example.test/demo/core'));
// Rendered: what the desk passes to the card for this repo keeps the CI tile and Post.
@@ -133,11 +133,11 @@ test('watching (GitHub): no quiet line, cards keep CI and Post', () => {
test('watching (a folder with no remote): read with git, "Landed changes only", counted as watched', () => {
const s = state({ repos: [APP, NOTES] });
const rows = m.repoRows(s);
- assert.equal(rows[1].state, 'Landed changes only · checked 09:00');
+ assert.equal(rows[1].state, 'Landed changes only · checked 9:00 AM');
assert.equal(rows[1].led, 'ok');
assert.equal(rows[1].note, LOCAL_TIP);
assert.equal(rows[1].origin, 'From Notes’s folder');
- assert.equal(rows[0].state, 'Watching · checked 09:00');
+ assert.equal(rows[0].state, 'Watching · checked 9:00 AM');
assert.equal(rows[0].note, null);
assert.equal(m.repoRows(state({ repos: [APP, { ...NOTES, polled_at: null }] }))[1].state, 'Landed changes only');
assert.equal(m.reposSummary(s), 'Watching 2 repos');
@@ -145,7 +145,7 @@ test('watching (a folder with no remote): read with git, "Landed changes only",
assert.deepEqual(m.repoFilters(s).map((f) => f.label), ['app', 'notes']);
const out = html(m.DevStatusLine, { spaceId: 'spc_demo', state: s });
assert.match(out, /data-dv-repo-note="true">Read from Notes’s folder on the server/);
- assert.match(out, /data-dv-repo-state="true" aria-describedby="([^"]+-note-1)">Landed changes only · checked 09:00<\/span>/);
+ assert.match(out, /data-dv-repo-state="true" aria-describedby="([^"]+-note-1)">Landed changes only · checked 9:00 AM<\/span>/);
assert.doesNotMatch(out, /Local folder, no remote/);
// The 0.7.1 shape (no repos[]): a local source is no longer turned into other_host.
const legacy = m.parseDevMode({ on: true, status: 'watching', repo: 'notes', sources: [{ team: 'Notes', repo: 'notes', host: null, from: 'local' }] });
@@ -238,7 +238,7 @@ test('too big (error): the row always reads "Too big to read"; the quiet line is
assert.match(out, /Too big to read/);
}
// A code on a non-error row changes nothing.
- assert.equal(m.repoRows(state({ repos: [APP, { ...LAB, poll_code: 'too_big' }] }))[1].state, 'Landed changes only · checked 09:00');
+ assert.equal(m.repoRows(state({ repos: [APP, { ...LAB, poll_code: 'too_big' }] }))[1].state, 'Landed changes only · checked 9:00 AM');
// Any other error keeps "Can't read it right now".
assert.equal(m.repoRows(state({ repos: [APP, { ...LAB, status: 'error', poll_error: 'Couldn’t reach the repo’s host.' }] }))[1].state, 'Can’t read it right now. Trying again.');
assert.equal(m.devSubLine(state({ repos: [cap] })).parts[0].text, 'Can’t read a repo');
diff --git a/frontend/tests/devAutodetect.test.mjs b/frontend/tests/devAutodetect.test.mjs
index c064966c..3e38e9f1 100644
--- a/frontend/tests/devAutodetect.test.mjs
+++ b/frontend/tests/devAutodetect.test.mjs
@@ -240,7 +240,7 @@ test('PX-2 (style-v2 §3/§4): header chip and subtitle, LED per status, Checked
const { root } = await desk({ status: st, ...extra }, { onOpenLooseEnds() {} });
const line = document.querySelector('[data-dv-status]');
assert.equal(line.querySelector('[data-dv-led]').dataset.s, want[st], `${st}: LED`);
- assert.match(line.querySelector('[data-dev-checked]').textContent, /^Checked \d\d:\d\d$/, `${st}: Checked lives in the status line`);
+ assert.match(line.querySelector('[data-dev-checked]').textContent, /^Checked \d{1,2}:\d\d [AP]M$/, `${st}: Checked lives in the status line`);
assert.equal(document.querySelectorAll('[data-dev-checked]').length, 1, `${st}: not in the header too`);
root.unmount();
}
diff --git a/frontend/tests/devCards.test.mjs b/frontend/tests/devCards.test.mjs
index daa7fa85..39054e83 100644
--- a/frontend/tests/devCards.test.mjs
+++ b/frontend/tests/devCards.test.mjs
@@ -164,7 +164,7 @@ test('B1: a direct commit (pr null) parses and draws as a normal landed card nam
assert.match(out, /class="kw-chip">Direct push</);
assert.match(out, /<a href="https:\/\/github\.com\/alexsergivan\/kwant\/commit\/c0ffee1"/);
assert.doesNotMatch(out, /PR #/);
- assert.match(out, /Committed 19:02/);
+ assert.match(out, /Committed 7:02 PM/);
assert.doesNotMatch(out, />Verified</);
assert.doesNotMatch(out, /data-verified/);
assert.doesNotMatch(out, /text-warn|kw-chip-warn|amber/, 'no warning tone: like an old merge with no reviewer');
@@ -203,7 +203,7 @@ test('the landed card: plain words, the details fold, a failed card and day sepa
assert.match(c, /What changes for you/);
assert.match(c, /<details/);
assert.match(c, /Under the hood<\/span><span aria-hidden="true">·<\/span><span class="font-mono[^"]*">4 files<\/span><span role="img" aria-label="249 lines added, 15 removed"/);
- assert.match(c, /Merged 18:48 by/);
+ assert.match(c, /Merged 6:48 PM by/);
assert.match(c, /Pixel<\/span><\/span><span>\(bot · Claude Sonnet\)/);
const f = html(m.LandedCard, { card: landed(fx.LANDED_NO_TEXT) });
assert.match(f, /Bump vite to 6\.4\.4/);
@@ -231,7 +231,7 @@ test('roll-up: title, needs-you tiles, +N more, the empty state, no routine link
assert.match(html(m.Rollup, { ...base, rollup: fx.ROLLUP_MANY }), /\+4 more areas/);
assert.match(html(m.Rollup, { ...base, rollup: fx.ROLLUP_MANY }), /main is red/);
const e = html(m.Rollup, { ...base, rollup: fx.ROLLUP_EMPTY, last_merge: { pr: 290, merged_at: '2026-11-04T19:26:00Z' } });
- assert.match(e, /Nothing landed since you last looked\. Last merge: #290, 19:26\./);
+ assert.match(e, /Nothing landed since you last looked\. Last merge: #290, 7:26 PM\./);
assert.deepEqual(m.needsYouAreas(fx.LANDED_ROUTE.cards.map((c) => m.parseLanded(c))), ['Chat', 'Live activity']);
const { branch: _b, ...noBranch } = base;
@@ -541,7 +541,7 @@ test('Fix it sends the finding and offers Undo for 10 s', async () => {
});
await click(button(host.querySelector('[data-finding="f1"]'), 'Fix it'));
const row = host.querySelector('[data-finding="f1"]');
- assert.match(row.textContent, /Sent to Pixel as a task · 01:00/);
+ assert.match(row.textContent, /Sent to Pixel as a task · 1:00 AM/);
assert.match(button(row, 'Undo').textContent, /8 s/);
await click(button(row, 'Undo'));
assert.deepEqual(actions, [['f1', 'fix'], ['f1', 'undo_fix']]);
diff --git a/frontend/tests/devMode.test.mjs b/frontend/tests/devMode.test.mjs
index 4cf7e665..567a3575 100644
--- a/frontend/tests/devMode.test.mjs
+++ b/frontend/tests/devMode.test.mjs
@@ -744,7 +744,7 @@ test('round 2: the Dev desk header shows the repo chip and when it was checked;
const chip = host.querySelector('[data-dev-repo-chip]');
assert.equal(chip.textContent, 'demo-org/demo-app · trunk');
assert.ok(chip.classList.contains('hidden') && chip.classList.contains('sm:inline-flex'), 'chip hides at 390');
- assert.match(host.querySelector('[data-dev-checked]').textContent, /^Checked \d\d:\d\d$/);
+ assert.match(host.querySelector('[data-dev-checked]').textContent, /^Checked \d{1,2}:\d\d [AP]M$/);
// style-v2 §3: tabs are .kw-dv-tab (44 px under 640 px in devStatus.css), active = 2 px underline.
for (const t of host.querySelectorAll('[role="tab"]')) assert.ok(t.classList.contains('kw-dv-tab'));
root.unmount();
diff --git a/frontend/tests/devTeamRepos.test.mjs b/frontend/tests/devTeamRepos.test.mjs
index 12cdb4b2..2f895d98 100644
--- a/frontend/tests/devTeamRepos.test.mjs
+++ b/frontend/tests/devTeamRepos.test.mjs
@@ -153,7 +153,7 @@ test('two repos: "Watching 2 repos" over two rows, open', () => {
const l = m.statusLine(state({ repos: [APP, SITE] }), TEAMS);
assert.equal(text(l), 'Watching 2 repos');
assert.equal(l.collapsed, false);
- assert.deepEqual(l.rows.map((r) => [r.team, r.repo.repo, r.repo.branch, r.state.replace(/\d\d:\d\d( [AP]M)?/, 'HH:MM'), r.origin, r.action]), [
+ assert.deepEqual(l.rows.map((r) => [r.team, r.repo.repo, r.repo.branch, r.state.replace(/\d{1,2}:\d\d( [AP]M)?/, 'HH:MM'), r.origin, r.action]), [
['App', 'demo-org/app', 'main', 'Watching · checked HH:MM', 'From App’s folder', null],
['Site', 'demo-org/site', 'trunk', 'Watching · checked HH:MM', 'From Site’s repo link', null],
]);
@@ -169,7 +169,7 @@ test('four rows fold behind the summary; each status has its words, LED and at m
assert.equal(l.collapsed, true);
assert.equal(text(l), 'Watching 1 of 5 repos · 2 need you', 'needs you = not_connected + error');
assert.equal(l.led, 'bad', 'a failing repo lights the line red');
- assert.deepEqual(l.rows.map((r) => [r.state.replace(/\d\d:\d\d( [AP]M)?/, 'HH:MM'), r.led, r.action]), [
+ assert.deepEqual(l.rows.map((r) => [r.state.replace(/\d{1,2}:\d\d( [AP]M)?/, 'HH:MM'), r.led, r.action]), [
['Watching · checked HH:MM', 'ok', null],
['Needs your GitHub connection', 'warn', 'connect'],
['Can’t read it right now. Trying again.', 'bad', 'remove'],
@@ -336,12 +336,12 @@ test('Ada (0.7.2): linking a repo while Dev mode is off sends on: false, and the
assert.equal(server.state.on, false);
});
-test('Ada (0.7.2): repo rows say "checked 15:30" in the desk header’s 24-hour format', () => {
+test('Ada (0.7.2): repo rows say "checked 3:30 PM" in the desk header’s format (the device clock)', () => {
const at = new Date(2026, 10, 6, 15, 30).toISOString();
const l = m.statusLine(state({ repos: [{ ...APP, polled_at: at }, SITE] }), TEAMS);
- assert.equal(l.rows[0].state, 'Watching · checked 15:30');
+ assert.equal(l.rows[0].state, 'Watching · checked 3:30 PM');
assert.equal(m.checkedTime(at), m.checkedLabel(Date.parse(at)));
- assert.equal(m.checkedTime(new Date(2026, 10, 6, 9, 5).toISOString()), '09:05');
+ assert.equal(m.checkedTime(new Date(2026, 10, 6, 9, 5).toISOString()), '9:05 AM');
});
test('DOM: Esc closes the Link field and puts focus back on its button', async () => {
diff --git a/frontend/tests/failover.test.mjs b/frontend/tests/failover.test.mjs
index 0e42b1ac..e3954f25 100644
--- a/frontend/tests/failover.test.mjs
+++ b/frontend/tests/failover.test.mjs
@@ -40,8 +40,8 @@ test('status words: Ready, Out until a local time, Signed out', () => {
const out = m.priorityStatus(list[0], engine('claude'), NOW);
assert.equal(out.tone, 'warn');
assert.match(out.label, /^Out until /);
- assert.match(out.label, /03:00/);
- assert.match(out.label, /^Out until \w{3} 03:00$/, 'a reset on another day names the day');
+ assert.match(out.label, /3:00 AM/);
+ assert.match(out.label, /^Out until \w{3} 3:00 AM$/, 'a reset on another day names the day');
assert.equal(m.priorityStatus(list[3], engine('grok'), NOW).label, 'Signed out');
assert.equal(m.priorityStatus(profile({ last_error: 'auth' }), engine('claude'), NOW).label, 'Signed out');
assert.equal(m.priorityStatus(profile({ enabled: false, limited_until: '2026-11-03T03:00:00' }), engine('claude'), NOW).label, 'Off');
@@ -49,7 +49,7 @@ test('status words: Ready, Out until a local time, Signed out', () => {
// A limit that has passed is Ready again, with no action.
assert.equal(m.priorityStatus(profile({ limited_until: '2026-11-02T19:00:00' }), engine('claude'), NOW).label, 'Ready');
// Same-day reset is the bare time.
- assert.equal(m.priorityStatus(profile({ limited_until: '2026-11-02T23:30:00' }), engine('claude'), NOW).label, 'Out until 23:30');
+ assert.equal(m.priorityStatus(profile({ limited_until: '2026-11-02T23:30:00' }), engine('claude'), NOW).label, 'Out until 11:30 PM');
});
test('moving rewrites only the priorities that change', () => {
@@ -93,12 +93,12 @@ test('the list groups accounts by how bots use them, titled by the AI, with a st
test('the failover notice is one short line, naming the limit time and the model', () => {
const e = { kwant_id: 'k', from_profile_id: 'c1', from_name: 'Work', to_profile_id: 'x1', to_name: 'Personal', class: 'quota',
retry_at: '2026-11-02T23:30:00', from_engine: 'claude', to_engine: 'codex', to_model: 'GPT-6.1' };
- assert.equal(m.failoverNotice(e, NOW), 'Claude is out until 23:30 · answered on Codex (GPT-6.1)');
+ assert.equal(m.failoverNotice(e, NOW), 'Claude is out until 11:30 PM · answered on Codex (GPT-6.1)');
assert.equal(m.failoverNotice({ ...e, class: 'auth', retry_at: undefined }, NOW), 'Claude is signed out · answered on Codex (GPT-6.1)');
assert.equal(m.failoverNotice({ ...e, retry_at: undefined }, NOW), 'Claude is out of usage · answered on Codex (GPT-6.1)');
// An older server sends no engine or model: the account names stand in.
assert.equal(m.failoverNotice({ ...e, from_engine: undefined, to_engine: undefined, to_model: undefined, retry_at: undefined }, NOW), 'Work is out of usage · answered on Personal');
- assert.equal(m.failoverNotice({ ...e, to_model: undefined, to_model_label: 'GPT-6.1' }, NOW), 'Claude is out until 23:30 · answered on Codex (GPT-6.1)');
+ assert.equal(m.failoverNotice({ ...e, to_model: undefined, to_model_label: 'GPT-6.1' }, NOW), 'Claude is out until 11:30 PM · answered on Codex (GPT-6.1)');
});
test('a chat is told once per outage', () => {
@@ -143,7 +143,7 @@ test('a saved reply reads its notice from meta.failover, so it survives a reload
const sw = { kwant_id: 'k', from_profile_id: 'c1', to_profile_id: 'x1', from_name: 'Work', to_name: 'Personal', class: 'quota', retry_at: '2026-11-03T02:00:00Z', from_engine: 'claude', to_engine: 'codex', to_model: 'gpt-6.1' };
const now = Date.parse('2026-11-02T20:00:00Z');
const line = m.savedFailoverNotice(JSON.stringify({ failover: [sw] }), now);
- assert.match(line, /^Claude is out until .*\d\d:\d\d · answered on Codex \(gpt-6\.1\)$/);
+ assert.match(line, /^Claude is out until .*\d{1,2}:\d\d [AP]M · answered on Codex \(gpt-6\.1\)$/);
// Already parsed, and a single object, read the same.
assert.equal(m.savedFailoverNotice({ failover: sw }, now), line);
// Two switches in one reply: first account out, last one answered.
diff --git a/frontend/tests/h5Followups.test.mjs b/frontend/tests/h5Followups.test.mjs
index f117e0d9..2324f1c7 100644
--- a/frontend/tests/h5Followups.test.mjs
+++ b/frontend/tests/h5Followups.test.mjs
@@ -85,7 +85,7 @@ test('N2: gave up reads "stopped after 2 tries"; needs-you still beats stuck; st
const needs = m.needsYouRows([item('question', 'lin', { timestamp: at(1) })], {}, all);
const att = m.attentionRows({ kwants, needs, failed: [], finished: [], busy: {}, status: {}, h4, now: NOW });
assert.deepEqual(order(att).slice(0, 3), ['1:Lin', '2:Rigel', '2:Vega']);
- assert.equal(att.find((r) => r.kwant.id === 'veg').line, 'Stuck: stopped after 2 tries · 11:55');
+ assert.equal(att.find((r) => r.kwant.id === 'veg').line, 'Stuck: stopped after 2 tries · 11:55 AM');
assert.equal(att.find((r) => r.kwant.id === 'rig').line, 'Stuck: the AI stopped answering');
});
@@ -124,11 +124,11 @@ test('N3: a held reply becomes a held line; only gave-up offers Try again', () =
const gaveUp = m.heldLine(hs, st('jun', 'stuck', { reason_code: 'stalled_gave_up', stuck: { gave_up_at: '2026-11-10T11:50:00Z', tries: 2 } }));
assert.equal(gaveUp.tryAgain, true);
- assert.equal(gaveUp.text, 'Waiting for Juno: Juno stopped after 2 tries at 11:50. Your message is kept and goes through when Juno runs again.');
+ assert.equal(gaveUp.text, 'Waiting for Juno: Juno stopped after 2 tries at 11:50 AM. Your message is kept and goes through when Juno runs again.');
const q = m.heldLine(m.heldFromReply(reply('waits_on_you', { question: { asked_at: '2026-11-10T14:08:00Z' } }), 't2'));
assert.equal(q.tryAgain, false);
- assert.equal(q.text, 'Queued for Juno: Juno is waiting for your answer to its question (14:08). It goes through when you answer.');
+ assert.equal(q.text, 'Queued for Juno: Juno is waiting for your answer to its question (2:08 PM). It goes through when you answer.');
assert.equal(m.heldLine(m.heldFromReply(reply('paused'), 't3')).tryAgain, false);
});
diff --git a/frontend/tests/heldReload.test.mjs b/frontend/tests/heldReload.test.mjs
index 5c0c2bc1..c879c5c8 100644
--- a/frontend/tests/heldReload.test.mjs
+++ b/frontend/tests/heldReload.test.mjs
@@ -20,7 +20,7 @@ test('reload with 1 held message: its line comes back from the status, with Try
assert.deepEqual([rows[0].messageId, rows[0].kwantId, rows[0].name, rows[0].reason], ['m-1', 'jun', 'Juno', 'stuck']);
const line = m.heldLine(rows[0], status.jun);
assert.equal(line.tryAgain, true);
- assert.match(line.text, /^Waiting for Juno: Juno stopped after 2 tries at 04:05\. Your message is kept/);
+ assert.match(line.text, /^Waiting for Juno: Juno stopped after 2 tries at 4:05 AM\. Your message is kept/);
});
test('reload with 3 held messages to one bot: every one gets its own line; hand-offs get none', () => {
@@ -44,7 +44,7 @@ test('a waits_on_you hold rebuilt from the status keeps the question time; unkno
const s = m.parseH4Status({ kwant_id: 'lin', status: 'needs_you', reason_code: 'asked_question', question: { id: 'q', asked_at: '2026-11-11T03:58:00Z' }, held: [msg('m-7', { reason_code: 'waits_on_you' })] });
const [row] = m.heldMessages([], { lin: s }, nameOf);
assert.equal(row.reason, 'waits_on_you');
- assert.match(m.heldLine(row, s).text, /^Queued for Lin: Lin is waiting for your answer to its question \(03:58\)\./);
+ assert.match(m.heldLine(row, s).text, /^Queued for Lin: Lin is waiting for your answer to its question \(3:58 AM\)\./);
const [anon] = m.heldMessages([], { zed: { ...s, kwant_id: 'zed' } }, nameOf);
assert.equal(anon.name, 'The bot');
});
diff --git a/frontend/tests/inboxAway095.test.mjs b/frontend/tests/inboxAway095.test.mjs
index fc2230be..100544a6 100644
--- a/frontend/tests/inboxAway095.test.mjs
+++ b/frontend/tests/inboxAway095.test.mjs
@@ -69,14 +69,14 @@ test('sections: Needs you holds waiting and failed, Done holds to review and fin
test('meta line: what ran, when, and why; without the run it leaves the why out', () => {
const it = fx.AWAY_ROUTINE_REVIEW;
- assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, fx.AWAY_RUN), 'Ben · routine, every Mon 09:00 · ran 22:51 because you pressed Run now');
- assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, { ...fx.AWAY_RUN, trigger: 'schedule' }), 'Ben · routine, every Mon 09:00 · ran 22:51 on schedule');
- assert.equal(a.metaLine({ ...it, source: undefined }, null, null), 'Ben · routine · ran 22:51');
+ assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, fx.AWAY_RUN), 'Ben · routine, every Mon 9:00 AM · ran 10:51 PM because you pressed Run now');
+ assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, { ...fx.AWAY_RUN, trigger: 'schedule' }), 'Ben · routine, every Mon 9:00 AM · ran 10:51 PM on schedule');
+ assert.equal(a.metaLine({ ...it, source: undefined }, null, null), 'Ben · routine · ran 10:51 PM');
// Part B's source.trigger, when the run isn't loaded; an app event says so (Needs B 5).
- assert.equal(a.metaLine(it, null, null), 'Ben · routine · ran 22:51 because you pressed Run now');
- assert.equal(a.metaLine({ ...it, source: { ...it.source, trigger: 'event' } }, null, null), 'Ben · routine · ran 22:51 on an app event');
- assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, { ...fx.AWAY_RUN, trigger: 'event' }), 'Ben · routine, every Mon 09:00 · ran 22:51 on an app event');
- assert.equal(a.scheduleShort({ type: 'daily', time: '08:30', tz: 'UTC' }), 'every day 08:30');
+ assert.equal(a.metaLine(it, null, null), 'Ben · routine · ran 10:51 PM because you pressed Run now');
+ assert.equal(a.metaLine({ ...it, source: { ...it.source, trigger: 'event' } }, null, null), 'Ben · routine · ran 10:51 PM on an app event');
+ assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, { ...fx.AWAY_RUN, trigger: 'event' }), 'Ben · routine, every Mon 9:00 AM · ran 10:51 PM on an app event');
+ assert.equal(a.scheduleShort({ type: 'daily', time: '08:30', tz: 'UTC' }), 'every day 8:30 AM');
assert.equal(a.scheduleShort({ type: 'interval', every_minutes: 120 }), 'every 2 h');
assert.equal(a.scheduleShort(null), '');
});
@@ -84,10 +84,10 @@ test('meta line: what ran, when, and why; without the run it leaves the why out'
test('trail: tool steps at their own time, thinking left out, then where the answer was written', () => {
const rows = a.trailFrom(fx.AWAY_MESSAGE, '@Spring launch');
assert.deepEqual(rows.map((r) => `${r.at} ${r.what}${r.detail ? ' · ' + r.detail : ''}`), [
- '22:51:02 Opened beanline.example.com · found House Blend 1 kg $24.00, 15% off until Mar 31',
- '22:51:05 Opened roastco.example.com · found 1 kg $27.00, free shipping over $40',
- '22:51:09 Compared with last Monday’s run · nothing changed',
- '22:51:10 Wrote the answer in @Spring launch',
+ '10:51:02 PM Opened beanline.example.com · found House Blend 1 kg $24.00, 15% off until Mar 31',
+ '10:51:05 PM Opened roastco.example.com · found 1 kg $27.00, free shipping over $40',
+ '10:51:09 PM Compared with last Monday’s run · nothing changed',
+ '10:51:10 PM Wrote the answer in @Spring launch',
]);
assert.deepEqual(a.trailFrom({ ...fx.AWAY_MESSAGE, meta: null }, 'x'), [], 'no saved steps: no made-up trail');
assert.deepEqual(a.trailFrom(null, 'x'), []);
@@ -161,7 +161,7 @@ test('pane order: meta, chips, answer with Open in chat, What Ben did, Why, then
for (let i = 1; i < els.length; i++) {
assert.ok(els[i - 1].compareDocumentPosition(els[i]) & Node.DOCUMENT_POSITION_FOLLOWING, `${order[i - 1]} comes before ${order[i]}`);
}
- assert.equal(q('[data-done-meta]').textContent, 'Ben · routine, every Mon 09:00 · ran 22:51 because you pressed Run now');
+ assert.equal(q('[data-done-meta]').textContent, 'Ben · routine, every Mon 9:00 AM · ran 10:51 PM because you pressed Run now');
assert.match(q('[data-chip="read-only"]').textContent, /Read only · changed nothing/);
assert.match(q('[data-chip="no-checks"]').textContent, /No checks set · Add one/);
// F2: a neutral chip, not amber; F1: the inline links stay compact and keep the 44 px tap area.
@@ -216,7 +216,7 @@ test('a team job opens in the pane: led-by meta, the lead’s answer, the team
const opened = [];
const { q, qa, root } = await mountInbox({ onOpenMessage: (t) => opened.push(t) });
await click(q('[data-option="tj-spring"]'));
- assert.equal(q('[data-done-meta]').textContent, 'Ann led Ben and Cody · finished 22:45');
+ assert.equal(q('[data-done-meta]').textContent, 'Ann led Ben and Cody · finished 10:45 PM');
assert.equal(q('[data-done-answer] h3').textContent, 'Ann’s answer');
assert.match(q('[data-answer-text]').textContent, /^Done: Ben checked 2 shops/, 'the served excerpt, as text');
assert.equal(q('[data-done-trail] h3').textContent, 'What the team did');
@@ -251,7 +251,7 @@ test('F7: a finished hand-off with no review and no part B fields: summary answe
const chats = [];
const { q, root } = await mountInbox({ onOpen: (i) => chats.push(i.id) }, data);
await click(q('[data-option="d-spring"]'));
- assert.equal(q('[data-done-meta]').textContent, 'Cody · finished 22:45');
+ assert.equal(q('[data-done-meta]').textContent, 'Cody · finished 10:45 PM');
assert.match(q('[data-answer-text]').textContent, /Drafted the sale email/);
assert.equal(q('[data-done-trail]'), null, 'no trail for a job the API has no steps for');
assert.equal(q('[data-redo]').textContent.trim(), 'Ask Cody to redo in chat');
@@ -280,7 +280,7 @@ test('the pane loads routine, run and message itself through the done api', asyn
await click(q('[data-option="r-prices"]'));
await settle(20);
assert.deepEqual(calls, ['routines', 'runs:rt-prices', 'message:m-prices']);
- assert.equal(q('[data-done-meta]').textContent, 'Ben · routine, every Mon 09:00 · ran 22:51 because you pressed Run now');
+ assert.equal(q('[data-done-meta]').textContent, 'Ben · routine, every Mon 9:00 AM · ran 10:51 PM because you pressed Run now');
assert.equal(q('[data-chip="read-only"]') !== null, true);
root.unmount();
});
diff --git a/frontend/tests/jiraSetup.test.mjs b/frontend/tests/jiraSetup.test.mjs
index 74ee5721..69f87093 100644
--- a/frontend/tests/jiraSetup.test.mjs
+++ b/frontend/tests/jiraSetup.test.mjs
@@ -409,7 +409,7 @@ test('errors: a rejected token, an address with no Jira, no projects visible (it
await step1(s);
await click(s.$('[data-jira-check]'));
await settle(20);
- assert.match(s.$('[data-jira-slow]').textContent, /Jira asked us to slow down\. Trying again at 10:09\./);
+ assert.match(s.$('[data-jira-slow]').textContent, /Jira asked us to slow down\. Trying again at 10:09 AM\./);
s.unmount();
});
diff --git a/frontend/tests/missionWatch.test.mjs b/frontend/tests/missionWatch.test.mjs
index d5d47bc4..e17b3768 100644
--- a/frontend/tests/missionWatch.test.mjs
+++ b/frontend/tests/missionWatch.test.mjs
@@ -113,13 +113,13 @@ test('chipView: every state', () => {
assert.equal(ck.icon, 'loader');
assert.equal(ck.text, 'Rigel is checking the claims');
const dh = v(watch({ state: 'dont_hold', last_check: lastCheck({ claims: 3, dont_hold: 1, needs_you: 1, cant_tell: 0, holds: 1 }) }));
- assert.deepEqual([dh.text, dh.tone, dh.click], ['1 claim doesn’t hold · 18:14', 'rose', 'report']);
- assert.equal(v(watch({ state: 'dont_hold', last_check: lastCheck({ claims: 3, dont_hold: 2, needs_you: 0, cant_tell: 0, holds: 1 }) })).text, '2 claims don’t hold · 18:14');
+ assert.deepEqual([dh.text, dh.tone, dh.click], ['1 claim doesn’t hold · 6:14 PM', 'rose', 'report']);
+ assert.equal(v(watch({ state: 'dont_hold', last_check: lastCheck({ claims: 3, dont_hold: 2, needs_you: 0, cant_tell: 0, holds: 1 }) })).text, '2 claims don’t hold · 6:14 PM');
const ah = v(watch({ state: 'all_hold', last_check: lastCheck({ claims: 4, dont_hold: 0, needs_you: 0, cant_tell: 0, holds: 4 }) }));
- assert.deepEqual([ah.text, ah.tone], ['All 4 claims hold · 18:14', 'teal']);
+ assert.deepEqual([ah.text, ah.tone], ['All 4 claims hold · 6:14 PM', 'teal']);
const ct = v(watch({ state: 'cant_tell', last_check: lastCheck({ claims: 4, dont_hold: 0, needs_you: 0, cant_tell: 1, holds: 3 }) }));
- assert.deepEqual([ct.text, ct.tone], ['4 claims checked · 18:14', 'muted']);
- assert.equal(v(watch({ state: 'same_stop', last_check: lastCheck({ claims: 1, dont_hold: 0, needs_you: 0, cant_tell: 0, holds: 1 }) })).text, 'No change since the 18:14 check');
+ assert.deepEqual([ct.text, ct.tone], ['4 claims checked · 6:14 PM', 'muted']);
+ assert.equal(v(watch({ state: 'same_stop', last_check: lastCheck({ claims: 1, dont_hold: 0, needs_you: 0, cant_tell: 0, holds: 1 }) })).text, 'No change since the 6:14 PM check');
const cr = v(watch({ state: 'cant_run', reason: { code: 'no_model', text: 'it has no model' } }));
assert.deepEqual([cr.text, cr.tone], ['Rigel can’t check: it has no model', 'amber']);
assert.equal(v(watch({ state: 'over_limit' })).tone, 'amber');
@@ -145,11 +145,11 @@ test('orderClaims, tints and summary chips follow the design and the server coun
test('chat text, needs-you lines and code parts', () => {
const r = w.parseReport(rawReport());
- assert.equal(w.chatText(r, TZ), 'Checked 3 claims after the mission stopped at 18:10. 1 don’t hold, 1 needs you, 2 hold. I restarted Write the tests with Lin.');
+ assert.equal(w.chatText(r, TZ), 'Checked 3 claims after the mission stopped at 6:10 PM. 1 don’t hold, 1 needs you, 2 hold. I restarted Write the tests with Lin.');
const all = w.parseReport(rawReport({ counts: { claims: 1, dont_hold: 0, needs_you: 0, cant_tell: 0, holds: 1 }, claims: [claim({ verdict: 'holds' })], actions: [] }));
- assert.equal(w.chatText(all, TZ), 'Checked 1 claim after the mission stopped at 18:10. All hold.');
+ assert.equal(w.chatText(all, TZ), 'Checked 1 claim after the mission stopped at 6:10 PM. All hold.');
const a = w.firstNeedsYou(r);
- assert.equal(w.youText(r, a, TZ), 'Deploy the site waits for your OK to deploy since 18:12.');
+ assert.equal(w.youText(r, a, TZ), 'Deploy the site waits for your OK to deploy since 6:12 PM.');
assert.deepEqual(w.codeParts('Ran `npm test` now'), [{ code: false, text: 'Ran ' }, { code: true, text: 'npm test' }, { code: false, text: ' now' }]);
assert.equal(w.failedChatText('the turn timed out'), 'The check failed: the turn timed out. Nothing was restarted.');
});
diff --git a/frontend/tests/oneClock.test.mjs b/frontend/tests/oneClock.test.mjs
new file mode 100644
index 00000000..ee6d235e
--- /dev/null
+++ b/frontend/tests/oneClock.test.mjs
@@ -0,0 +1,112 @@
+// One clock (roadmap 13c, autonomy/one-clock/brief.md): every time in the app goes through src/clock.ts on the
+// device's own locale. The table pins en-US (12 h) and en-GB (24 h) by passing the locale; the app passes none.
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { loadBundled } from './bundle.mjs';
+
+process.env.TZ = 'UTC';
+globalThis.localStorage ??= { getItem: () => null, setItem: () => {}, removeItem: () => {} };
+
+const m = await loadBundled(`
+ export * from './src/clock';
+ export { describeSchedule, formatWhen } from './src/continuity';
+ export { clock as reviewClock } from './src/reviewItem';
+ export { callTime, shortDate } from './src/agentConnections';
+ export { hm } from './src/missionWatch';
+ export { dayLabel as usageDay } from './src/components/DailyUsage';
+ export { dayLabel as devDay } from './src/devMode';
+ export { onceWords } from './src/botActions';
+ export { clock as inboxClock } from './src/components/InboxNew';
+ export { hm as awayHm, scheduleShort } from './src/doneAway';
+ export { checkedLabel } from './src/devMode';
+ export { dayLabel as worktreeDay } from './src/dev/worktrees';
+`);
+
+// Some ICU builds put a narrow no-break space before AM/PM; compare on plain spaces.
+const n = (s) => (typeof s === 'string' ? s.replace(/[  ]/g, ' ') : s);
+const AT = '2026-11-16T20:15:00Z'; // a Monday
+const MORNING = '2026-11-16T08:30:00Z';
+
+const TABLE = [
+ ['timeText', () => [m.timeText(AT, { locale: 'en-US' }), m.timeText(AT, { locale: 'en-GB' })], ['8:15 PM', '20:15']],
+ ['timeText morning', () => [m.timeText(MORNING, { locale: 'en-US' }), m.timeText(MORNING, { locale: 'en-GB' })], ['8:30 AM', '08:30']],
+ ['timeText with a zone', () => [m.timeText(AT, { locale: 'en-US', timeZone: 'Asia/Kolkata' }), m.timeText(AT, { locale: 'en-GB', timeZone: 'Asia/Kolkata' })], ['1:45 AM', '01:45']],
+ ['dateText', () => [m.dateText(AT, { locale: 'en-US' }), m.dateText(AT, { locale: 'en-GB' })], ['Nov 16', '16 Nov']],
+ ['dateText weekday + year', () => [m.dateText(AT, { locale: 'en-US', weekday: true, year: true }), m.dateText(AT, { locale: 'en-GB', weekday: true, year: true })], ['Mon, Nov 16, 2026', 'Mon, 16 Nov 2026']],
+ ['weekdayClock (a Next line)', () => [m.weekdayClock(MORNING, { locale: 'en-US' }), m.weekdayClock(MORNING, { locale: 'en-GB' })], ['Mon, Nov 16, 8:30 AM', 'Mon 16 Nov, 08:30']],
+ ['dateClock', () => [m.dateClock(AT, { locale: 'en-US' }), m.dateClock(AT, { locale: 'en-GB' })], ['Nov 16, 8:15 PM', '16 Nov, 20:15']],
+ ['wallClock 08:30', () => [m.wallClock('08:30', 'en-US'), m.wallClock('08:30', 'en-GB')], ['8:30 AM', '08:30']],
+ ['wallClock 20:05', () => [m.wallClock('20:05', 'en-US'), m.wallClock('20:05', 'en-GB')], ['8:05 PM', '20:05']],
+ ['secondsText (step logs)', () => [m.secondsText(AT, { locale: 'en-US' }), m.secondsText(AT, { locale: 'en-GB' })], ['8:15:00 PM', '20:15:00']],
+ ['wallClock midnight', () => [m.wallClock('00:00', 'en-US'), m.wallClock('00:00', 'en-GB')], ['12:00 AM', '00:00']],
+];
+
+for (const [name, run, want] of TABLE) {
+ test(`clock: ${name} in en-US and en-GB`, () => assert.deepEqual(run().map(n), want));
+}
+
+test('clock: missing or unreadable times give null; wallClock keeps what it cannot read', () => {
+ for (const f of [m.timeText, m.dateText, m.weekdayClock, m.dateClock]) {
+ assert.equal(f(null), null);
+ assert.equal(f(''), null);
+ assert.equal(f('not a time'), null);
+ }
+ assert.equal(m.wallClock('8.30'), '8.30');
+ assert.equal(m.wallClock('25:00'), '25:00');
+ assert.equal(m.wallClock(''), '');
+});
+
+test('clock: no locale means the device default, the same as the platform writes it', () => {
+ const want = new Date(AT).toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' });
+ assert.equal(m.timeText(AT), want);
+ assert.equal(m.wallClock('20:15'), want);
+});
+
+test('routines: the schedule and its Next line use the same clock', () => {
+ const s = { type: 'weekly', weekdays: ['monday'], time: '08:30', tz: 'UTC' };
+ const line = n(m.describeSchedule(s));
+ const want = n(m.wallClock('08:30'));
+ assert.ok(line.includes(`at ${want},`), line);
+ assert.ok(n(m.formatWhen(MORNING)).endsWith(want), m.formatWhen(MORNING));
+ assert.equal(n(m.formatWhen(MORNING, 'en-US')), 'Mon, Nov 16, 8:30 AM');
+ assert.equal(n(m.describeSchedule({ type: 'daily', time: '17:00', tz: 'UTC' })).includes(n(m.wallClock('17:00'))), true);
+ assert.equal(m.formatWhen(null), '—');
+});
+
+test('call sites that forced 24 h or en-GB now follow the locale', () => {
+ assert.equal(n(m.reviewClock(AT, 'en-US', Date.parse(AT))), '8:15 PM', 'the Inbox');
+ assert.equal(m.reviewClock(AT, 'en-GB', Date.parse(AT)), '20:15');
+ assert.equal(n(m.callTime(AT, new Date(AT), 'en-US')), '8:15 PM');
+ assert.equal(n(m.callTime(AT, new Date('2026-11-17T09:00:00Z'), 'en-US')), 'Nov 16, 8:15 PM');
+ assert.equal(m.callTime(AT, new Date('2026-11-17T09:00:00Z'), 'en-GB'), '16 Nov, 20:15');
+ assert.equal(m.shortDate(AT, 'en-US'), 'Nov 16, 2026');
+ assert.equal(m.shortDate(AT, 'en-GB'), '16 Nov 2026');
+ assert.equal(n(m.hm(AT, 'UTC', 'en-US')), '8:15 PM', 'missionWatch keeps its zone');
+ assert.equal(m.hm(AT, 'UTC', 'en-GB'), '20:15');
+ assert.equal(m.usageDay('2026-10-20', new Date(AT), 'en-US'), 'Tue, Oct 20', 'DailyUsage stays on the UTC day');
+ assert.equal(m.usageDay('2026-10-20', new Date(AT), 'en-GB'), 'Tue 20 Oct');
+ assert.equal(m.devDay('2026-11-03T10:00:00Z', new Date(AT), 'en-GB'), 'Tue 3 Nov');
+ assert.equal(n(m.onceWords('2026-11-06T15:00:00Z', 'en-US')), 'once on Fri, Nov 6 at 3:00 PM');
+});
+
+test('one clock: hand-built HH:MM spots now read the device clock (Inbox queue, Done-away, Dev desk, worktrees)', () => {
+ const want = n(m.timeText(AT));
+ assert.equal(n(m.inboxClock(AT, Date.parse(AT))), want);
+ assert.equal(n(m.awayHm(AT)), want);
+ assert.equal(n(m.checkedLabel(Date.parse(AT))), want);
+ assert.equal(n(m.worktreeDay(AT, Date.parse(AT)).time), want);
+ assert.equal(n(m.worktreeDay(AT, Date.parse('2026-12-01T10:00:00Z')).day), n(m.dateText(AT)));
+ assert.equal(n(m.scheduleShort({ type: 'weekly', time: '20:15', weekdays: ['mon'], tz: 'UTC' })), `every Mon ${n(m.wallClock('20:15'))}`);
+ assert.equal(m.inboxClock('nope'), '');
+});
+
+test('one clock: the Inbox row and review item carry the date on another day, like the card and chat (Round 2)', () => {
+ const LATER = Date.parse('2026-11-19T09:00:00Z');
+ assert.equal(n(m.inboxClock(AT, LATER)), n(m.localClock(AT, LATER)), 'the row follows localClock');
+ assert.equal(n(m.inboxClock(AT, LATER)), `${n(m.dateText(AT))}, ${want0()}`);
+ assert.equal(n(m.reviewClock(AT, 'en-US', LATER)), 'Nov 16, 8:15 PM', 'in Review since … yesterday or earlier');
+ assert.equal(m.reviewClock(AT, 'en-GB', LATER), '16 Nov, 20:15');
+ assert.equal(m.reviewClock(null), null);
+ assert.equal(m.reviewClock('nope'), null);
+});
+const want0 = () => n(m.timeText(AT));
diff --git a/frontend/tests/personTimezone.test.mjs b/frontend/tests/personTimezone.test.mjs
index 50b19b43..e961199a 100644
--- a/frontend/tests/personTimezone.test.mjs
+++ b/frontend/tests/personTimezone.test.mjs
@@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import test from 'node:test';
import ts from 'typescript';
+import { loadBundled } from './bundle.mjs';
const load = async (path) => {
const source = await readFile(new URL(path, import.meta.url), 'utf8');
@@ -9,7 +10,7 @@ const load = async (path) => {
return import(`data:text/javascript;base64,${Buffer.from(outputText).toString('base64')}`);
};
-const c = await load('../src/continuity.ts');
+const c = await loadBundled("export * from './src/continuity.ts';") // imports clock.ts, so it's bundled;
/** A fake server holding the `timezone` setting, with the server's own no-overwrite rule. */
function server(initial, { getStatus = 200, field = true } = {}) {
diff --git a/frontend/tests/postGithub.test.mjs b/frontend/tests/postGithub.test.mjs
index 06133f2d..fd43a72a 100644
--- a/frontend/tests/postGithub.test.mjs
+++ b/frontend/tests/postGithub.test.mjs
@@ -187,13 +187,13 @@ test('posting: spinner, button disabled and busy, a second press sends nothing;
await settle();
f = footer(host);
assert.equal(f.dataset.postState, 'posted');
- assert.match(flat(f), /^Posted 19:58 as @oleks-i · 3 inline comments\s*View on GitHub/);
+ assert.match(flat(f), /^Posted 7:58 PM as @oleks-i · 3 inline comments\s*View on GitHub/);
assert.equal(f.querySelector('.dv-led').dataset.s, 'ok', 'ok LED');
const a = f.querySelector('a[href="https://github.com/o/r/pull/294#pullrequestreview-1"]');
assert.ok(a, 'View on GitHub links to the review');
assert.equal(a.getAttribute('target'), '_blank');
assert.equal(!!button(f, 'Post to GitHub'), false, 'no button once posted');
- assert.equal(f.querySelector('[role="status"]').textContent, 'Posted 19:58 as @oleks-i · 3 inline comments');
+ assert.equal(f.querySelector('[role="status"]').textContent, 'Posted 7:58 PM as @oleks-i · 3 inline comments');
});
test('posted from the server (SSE refetch): the card prop alone switches the footer', async () => {
@@ -212,7 +212,7 @@ test('posted from the server (SSE refetch): the card prop alone switches the foo
test('posted without a url: "Posted 19:58" and no link', () => {
const out = html(m.ReviewCard, { card: { ...base(), posted: { ...POSTED, url: null } }, onFinding: async () => base(), onPost: async () => base(), now: NOW });
- assert.match(out, /Posted 19:58/);
+ assert.match(out, /Posted 7:58 PM/);
assert.doesNotMatch(out, /View on GitHub/);
});
@@ -381,7 +381,7 @@ test('F7: forge null shows neither the Post button nor the Open link, in every s
test('forge null but already posted: still says Posted, with the forge from posted', () => {
const out = html(m.ReviewCard, { card: { ...base(), posted: POSTED }, onFinding: async () => base(), now: NOW });
- assert.match(out, /Posted 19:58/);
+ assert.match(out, /Posted 7:58 PM/);
assert.match(out, /View on GitHub/);
});
diff --git a/frontend/tests/prepush.test.mjs b/frontend/tests/prepush.test.mjs
index 8a481c0d..ea9ecab9 100644
--- a/frontend/tests/prepush.test.mjs
+++ b/frontend/tests/prepush.test.mjs
@@ -128,9 +128,9 @@ test('counts come from the server: open findings are its blockers, never a check
assert.equal(m.inboxLine(card(fx.PP_NEEDS_YOU), 'Pixel'), "Pixel's push is waiting for you: 1 finding open");
assert.equal(m.inboxLine(card(fx.PP_FAILED_NEEDS_YOU), 'Pixel'), "Pixel's push is waiting for you: the checks couldn't run");
assert.equal(m.requiredPassed(card(fx.PP_CLEAR)), 5, 'semgrep not installed is not a passed check');
- assert.equal(m.clearedLine(card(fx.PP_CLEAR)), 'Cleared to push pixel/inbox-empty-state after 5 checks passed · 14:02');
+ assert.equal(m.clearedLine(card(fx.PP_CLEAR)), 'Cleared to push pixel/inbox-empty-state after 5 checks passed · 2:02 PM');
assert.equal(m.foldLine(card(fx.PP_NEEDS_YOU)), '4 checks passed · registry · tamper · rules · review');
- assert.equal(m.overriddenLine(card(fx.PP_OVERRIDDEN), 'Pixel'), 'You let this push go at 14:09 with 1 finding open. It covers this commit only.', 'old server, no grant: unchanged');
+ assert.equal(m.overriddenLine(card(fx.PP_OVERRIDDEN), 'Pixel'), 'You let this push go at 2:09 PM with 1 finding open. It covers this commit only.', 'old server, no grant: unchanged');
});
test('a check that could not run never reads as passed', () => {
@@ -180,7 +180,7 @@ test('P2 clear: a card seen live shows Clear, then folds to P2b after about 2 s;
const hist = await mount(m.PrepushCard, { card: card(fx.PP_CLEAR), bot: 'Pixel' });
assert.equal(hist.host.querySelector('[data-prepush-phase]').dataset.prepushPhase, 'P2b');
- assert.match(text(hist.host), /Cleared to push pixel\/inbox-empty-state after 5 checks passed · 14:02/);
+ assert.match(text(hist.host), /Cleared to push pixel\/inbox-empty-state after 5 checks passed · 2:02 PM/);
await click(button(hist.host, 'Show checks'));
assert.equal(hist.host.querySelector('[data-prepush-phase]').dataset.prepushPhase, 'P2');
assert.equal(hist.host.querySelectorAll('[data-check]').length, 6);
@@ -264,7 +264,7 @@ test('P5 shows the server\'s refusal and keeps the reason', async () => {
test('P6 pushed anyway: neutral chip, the time and the quoted reason; open findings stay rose; no actions', () => {
const out = html(m.PrepushCard, { card: card(fx.PP_OVERRIDDEN), bot: 'Pixel', onRetry: async () => {}, onOverride: async () => {} });
assert.match(out, /class="kw-chip shrink-0[^"]*"[^>]*>Pushed anyway/);
- assert.match(out, /You let this push go at 14:09 with 1 finding open\./);
+ assert.match(out, /You let this push go at 2:09 PM with 1 finding open\./);
assert.match(out, /<blockquote[^>]*>.*The key is a revoked test key/);
assert.match(out, /data-check="secrets" data-state="hit"/);
assert.doesNotMatch(out, /<button[^>]*>Push anyway/);
diff --git a/frontend/tests/prepushGrant.test.mjs b/frontend/tests/prepushGrant.test.mjs
index c8db7286..0b741567 100644
--- a/frontend/tests/prepushGrant.test.mjs
+++ b/frontend/tests/prepushGrant.test.mjs
@@ -77,7 +77,7 @@ const type = async (el, value) => {
// ---------------------------------------------------------------------------------------------------
// 0.9.7 prepush-grant (autonomy/prepush-retry/brief.md, Frontend): the press is the approval.
-const HM = (ms) => new Date(ms).toISOString().slice(11, 16);
+const HM = (ms) => new Date(ms).toLocaleTimeString(undefined, { timeStyle: 'short' }).replace(/\u202f/g, ' ');
const all = (...ks) => ks.map((k) => card(fx[k]));
test('grant and superseded parse; pushed is a known status now; a junk grant is dropped', () => {
diff --git a/frontend/tests/profiles.test.mjs b/frontend/tests/profiles.test.mjs
index e09279ac..953fbb34 100644
--- a/frontend/tests/profiles.test.mjs
+++ b/frontend/tests/profiles.test.mjs
@@ -10,7 +10,7 @@ const load = async (path) => {
return import(`data:text/javascript;base64,${Buffer.from(outputText).toString('base64')}`);
};
-const profiles = await load('../src/profiles.ts');
+const profiles = await loadBundled("export * from './src/profiles.ts';") // imports clock.ts, so it's bundled;
// auth.ts imports spaces.ts, so it's bundled.
const auth = await loadBundled("export * from './src/auth.ts';");
const activity = await load('../src/kwantActivity.ts');
diff --git a/frontend/tests/routinesSetup.test.mjs b/frontend/tests/routinesSetup.test.mjs
index bb9112b2..25d63c04 100644
--- a/frontend/tests/routinesSetup.test.mjs
+++ b/frontend/tests/routinesSetup.test.mjs
@@ -34,7 +34,7 @@ test('the card says what it does, then when it runs next, then schedule · bot
assert.match(h, /title="Check Beanline/);
assert.match(t, /Next [A-Z][a-z]{2}, Nov 1[56]/);
assert.match(t, /last ran Mon, Nov 9/);
- assert.match(t, /Every Monday at 09:00, Kyiv time · Ben · #spring-launch/);
+ assert.match(t, /Every Monday at 9:00 AM, Kyiv time · Ben · #spring-launch/);
assert.doesNotMatch(t, /Next run:|\(Europe\/Kyiv\)/);
// Order: name, first line, next, meta.
assert.ok(t.indexOf('Competitor prices') < t.indexOf('Check Beanline'));
@@ -56,7 +56,7 @@ test('a paused routine says Paused and mutes its name and first line', () => {
test('a Mon–Fri routine reads "Weekdays at …"', () => {
const t = text(ui.row(rowProps({ schedule: { type: 'weekly', time: '08:30', weekdays: ['mon', 'tue', 'wed', 'thu', 'fri'], tz: 'Europe/Kyiv' } })));
- assert.match(t, /Weekdays at 08:30, Kyiv time/);
+ assert.match(t, /Weekdays at 8:30 AM, Kyiv time/);
});
test('phone: the four actions sit in a 4-column grid of 44 px buttons; desktop keeps the indented row', () => {
diff --git a/frontend/tests/tickets.test.mjs b/frontend/tests/tickets.test.mjs
index ae5172f3..7cbc1d22 100644
--- a/frontend/tests/tickets.test.mjs
+++ b/frontend/tests/tickets.test.mjs
@@ -391,7 +391,7 @@ test('picking a choice answers that question', async () => {
test('once asked, the card says it waits for the answer on Jira and offers See the comment', () => {
const out = html(m.TicketCard, { ...N, ticket: T('needs_answer'), brief: B(fx.BRIEF_ASKED), onAskPreview: async () => fx.ASK_PREVIEW });
- assert.match(out, /Asked Dana Park on Jira at 10:04\. You can still answer here\./);
+ assert.match(out, /Asked Dana Park on Jira at 10:04 AM\. You can still answer here\./);
assert.match(out, /Ann checks the Jira comment every 5 minutes\. The first answer wins, here or there\./);
assert.doesNotMatch(out, /data-ask=/);
});
diff --git a/frontend/tests/toolNotes.test.mjs b/frontend/tests/toolNotes.test.mjs
index 4a750039..c7ecb1bb 100644
--- a/frontend/tests/toolNotes.test.mjs
+++ b/frontend/tests/toolNotes.test.mjs
@@ -86,7 +86,7 @@ test('an open note: kind tag with icon and word, mono tool, ×3, bots and last t
assert.match(html, /×3/);
assert.match(html, /Pixel/);
assert.match(html, /Iris/);
- assert.match(html, /last \d\d:\d\d/);
+ assert.match(html, /last \d{1,2}:\d\d [AP]M/);
assert.match(html, /Mark fixed/);
assert.match(html, /aria-label="Edit note"/);
assert.match(html, /aria-label="More actions for this note"/);
@@ -109,7 +109,7 @@ test('edited and person-written notes say so; a removed connection’s tool is g
test('a fixed note: Fixed tag, grey text, when it was fixed, Reopen and a delete icon', () => {
const html = ui.section(props({ initialFilter: 'fixed', initialList: list([note({ state: 'fixed', fixed_at: '2026-11-10T14:20:00Z' })]) }));
assert.match(html, /data-note-kind="fixed"/);
- assert.match(html, /Fixed by you · \d\d:\d\d · bots no longer see it/);
+ assert.match(html, /Fixed by you · \d{1,2}:\d\d [AP]M · bots no longer see it/);
assert.match(html, /Reopen/);
assert.match(html, /aria-label="Delete note"/);
assert.doesNotMatch(html, /Mark fixed/);
diff --git a/frontend/tests/uiRefreshSignature.test.mjs b/frontend/tests/uiRefreshSignature.test.mjs
index e7ffe127..f6c69074 100644
--- a/frontend/tests/uiRefreshSignature.test.mjs
+++ b/frontend/tests/uiRefreshSignature.test.mjs
@@ -76,7 +76,7 @@ test('selectMood: finished fades after a moment, failed stays until the next tur
});
test('moodLabel: words for the tooltip, "Resting until 03:00" for quota', () => {
const at = new Date(2026, 10, 3, 3, 0);
- assert.equal(m.moodLabel('resting', 'Dev', at, new Date(2026, 10, 3, 1, 0).getTime()), 'Resting until 03:00');
+ assert.equal(m.moodLabel('resting', 'Dev', at, new Date(2026, 10, 3, 1, 0).getTime()), 'Resting until 3:00 AM');
assert.equal(m.moodLabel('needs_you', 'Dev'), 'Dev needs you');
assert.equal(m.moodLabel('failed', 'Dev'), "Dev's last turn failed");
assert.equal(m.moodLabel('idle', 'Dev'), null);
diff --git a/frontend/tests/usageHistory.test.mjs b/frontend/tests/usageHistory.test.mjs
index c6f24f96..4d99d9b7 100644
--- a/frontend/tests/usageHistory.test.mjs
+++ b/frontend/tests/usageHistory.test.mjs
@@ -69,7 +69,7 @@ test('the panel shows the window total, a bar per day, models and the day list',
assert.match(html, /\$1\.75<\/span><span[^>]*> in the last 7 days/);
assert.equal(html.match(/data-day="/g).length, 7);
assert.match(html, /aria-label="Today: \$1\.50"/);
- assert.match(html, /aria-label="Wed 11 Nov: no AI use"/);
+ assert.match(html, /aria-label="Wed, Nov 11: no AI use"/);
assert.match(html, /data-usage-readout="true"><\/span>/, "nothing named until a bar is hovered or focused");
// One tab stop for the bars: today's.
assert.equal(html.match(/<li tabindex="0"/g).length, 1);
diff --git a/frontend/tests/usageVisibility.test.mjs b/frontend/tests/usageVisibility.test.mjs
index b06899a4..cef94424 100644
--- a/frontend/tests/usageVisibility.test.mjs
+++ b/frontend/tests/usageVisibility.test.mjs
@@ -76,7 +76,7 @@ test('Settings → Usage groups days with fresh, cached and cost', () => {
const now = new Date('2026-10-26T15:00:00Z');
assert.equal(m.dayLabel('2026-10-26', now), 'Today');
assert.equal(m.dayLabel('2026-10-25', now), 'Yesterday');
- assert.equal(m.dayLabel('2026-10-24', now), 'Sat 24 Oct');
+ assert.equal(m.dayLabel('2026-10-24', now), 'Sat, Oct 24');
const html = m.daily({ rows, now });
assert.match(html, /Today/);
diff --git a/frontend/tests/waitingChecks.test.mjs b/frontend/tests/waitingChecks.test.mjs
index ec59dc3f..fb0b7128 100644
--- a/frontend/tests/waitingChecks.test.mjs
+++ b/frontend/tests/waitingChecks.test.mjs
@@ -1,5 +1,5 @@
// Waiting checks (0.9.7, #564): a check that waits on an outside service shows as one line on the
-// task card and in the task detail, "Waiting on <label> since 09:12 · next look 09:27", plus the
+// task card and in the task detail, "Waiting on <label> since 9:12 AM · next look 9:27 AM", plus the
// last line the script printed. Past its deadline the card moves to Needs you with a Wait N h more button.
import assert from 'node:assert/strict';
import test from 'node:test';
@@ -42,15 +42,15 @@ const task = (over = {}) => ({
test('a waiting check reads as one line with its clock times, the deadline and the last printed line', () => {
const l = w.waitLine(check(), NOW);
- assert.equal(w.waitLineText(l), 'Waiting on ./gate.sh since 09:12 · next look 09:27');
+ assert.equal(w.waitLineText(l), 'Waiting on ./gate.sh since 9:12 AM · next look 9:27 AM');
assert.equal(l.last, 'job 42: in_review (run 2)', "the script's last line, not kwant's run header");
- assert.match(l.deadline, /^If it isn’t ready by \S+ 09:12, it stops and tells you\.$/, 'tells you, as in the 0.9.7 copy');
+ assert.match(l.deadline, /^If it isn’t ready by \S+ 9:12 AM, it stops and tells you\.$/, 'tells you, as in the 0.9.7 copy');
assert.equal(l.timedOut, false);
});
test('a next look that is already due says soon; an http check waits on its address', () => {
const l = w.waitLine(check({ next_run_at: iso('2026-11-13T09:15:00') }), NOW);
- assert.equal(w.waitLineText(l), 'Waiting on ./gate.sh since 09:12 · next look soon');
+ assert.equal(w.waitLineText(l), 'Waiting on ./gate.sh since 9:12 AM · next look soon');
const h = w.waitLine(check({ kind: 'http', spec: { url: 'https://status.example/jobs/42', waiting_status: 202 } }), NOW);
assert.match(w.waitLineText(h), /^Waiting on https:\/\/status\.example\/jobs\/42 since/);
});
@@ -68,7 +68,7 @@ test('past its deadline the card line says it did not answer, and the detail say
assert.equal(l.hours, 72);
assert.equal(w.detailLineText(l), 'No answer in 72 h.');
assert.equal(w.detailLineText({ ...l, hours: null }), 'No answer in time.');
- assert.equal(w.detailLineText(w.waitLine(check(), NOW)), 'Waiting since 09:12 · next look 09:27');
+ assert.equal(w.detailLineText(w.waitLine(check(), NOW)), 'Waiting since 9:12 AM · next look 9:27 AM');
const det = ui.line({ line: l });
assert.ok(!det.includes('./gate.sh'), 'the detail row already shows the label');
assert.ok(!det.includes('<svg'), 'no second warning icon in the detail');
@@ -95,10 +95,10 @@ test('the line is labelled for screen readers and never renders HTML from the sc
const html = ui.line({ line: w.waitLine(check({ output_excerpt: 'run 1: not ready yet\n<img src=x onerror=alert(1)>' }), NOW) });
assert.ok(!html.includes('<img'), 'output is text');
assert.ok(html.includes('&lt;img'));
- assert.ok(html.includes('class="sr-only">Waiting since 09:12, next look 09:27<'));
- assert.ok(html.includes('>Waiting since 09:12 · next look 09:27<'));
+ assert.ok(html.includes('class="sr-only">Waiting since 9:12 AM, next look 9:27 AM<'));
+ assert.ok(html.includes('>Waiting since 9:12 AM · next look 9:27 AM<'));
assert.ok(!html.includes('text-zinc-500'), 'small grey text meets AA');
- assert.ok(ui.line({ line: w.waitLine(check(), NOW), compact: true }).includes('class="sr-only">Waiting on ./gate.sh since 09:12 · next look 09:27<'));
+ assert.ok(ui.line({ line: w.waitLine(check(), NOW), compact: true }).includes('class="sr-only">Waiting on ./gate.sh since 9:12 AM · next look 9:27 AM<'));
assert.ok(html.includes('It last printed: '));
assert.ok(html.includes('data-waiting-deadline'));
assert.ok(html.includes('aria-hidden="true"'));
diff --git a/frontend/tests/worktrees.test.mjs b/frontend/tests/worktrees.test.mjs
index 3b64b2fb..4b1d8ff5 100644
--- a/frontend/tests/worktrees.test.mjs
+++ b/frontend/tests/worktrees.test.mjs
@@ -121,13 +121,13 @@ test('parseList keeps repos, drops removed and malformed rows, and reads other w
test('row status and time copy', () => {
const W = (o) => m.parseWorktree(o);
assert.deepEqual(m.rowStatus(W(fx.WORKING), fx.NOW), { led: 'run', text: 'is working here', kind: 'working' });
- assert.equal(m.rowStatus(W(fx.FINISHED_DUE), fx.NOW).text, 'finished 13:42');
+ assert.equal(m.rowStatus(W(fx.FINISHED_DUE), fx.NOW).text, 'finished 1:42 PM');
assert.equal(m.rowStatus(W(fx.FINISHED_DUE), fx.NOW).led, 'ok');
assert.equal(m.rowStatus(W(fx.CLEANED), fx.NOW).text, 'finished yesterday');
assert.equal(m.rowStatus(W(fx.MINE), fx.NOW).text, 'made by you');
assert.equal(m.rowStatus(W(fx.MISSING), fx.NOW).kind, 'missing');
assert.equal(m.rowTime(W(fx.WORKING), fx.NOW), 'active now');
- assert.equal(m.rowTask(W(fx.MINE), fx.NOW), 'No task. Made from the Dev desk 09:12');
+ assert.equal(m.rowTask(W(fx.MINE), fx.NOW), 'No task. Made from the Dev desk 9:12 AM');
assert.equal(m.rowTask(W({ ...fx.MINE, thread_title: 'lin/search-index' }), fx.NOW), 'Chat: lin/search-index', 'thread_title (contract v3) when there is no task');
assert.equal(m.changesLabel(0), 'No uncommitted changes');
assert.equal(m.changesLabel(1), '1 uncommitted file');
@@ -137,17 +137,17 @@ test('row status and time copy', () => {
test('P3 states: due, kept, cleaning, cleaned with kept notes, failed', () => {
const W = (o) => m.parseWorktree(o);
- assert.deepEqual(m.p3State(W(fx.FINISHED_DUE)), { kind: 'due', at: '14:42', dirs: [] });
+ assert.deepEqual(m.p3State(W(fx.FINISHED_DUE)), { kind: 'due', at: '2:42 PM', dirs: [] });
assert.deepEqual(m.p3State(W({ ...fx.FINISHED_DUE, keep_build: true })), { kind: 'kept' });
assert.deepEqual(m.p3State(W(fx.FINISHED_DUE), { cleaning: true }), { kind: 'cleaning' });
- assert.deepEqual(m.p3State(W(fx.CLEANED)), { kind: 'cleaned', size: '1.2 GB', at: '18:40', dirs: ['.vite', 'target'] });
+ assert.deepEqual(m.p3State(W(fx.CLEANED)), { kind: 'cleaned', size: '1.2 GB', at: '6:40 PM', dirs: ['.vite', 'target'] });
assert.deepEqual(m.keptNotes(W(fx.CLEANED)), ['Kept dist: Git tracks a file in it.']);
assert.equal(m.p3State(W(fx.WORKING)), null);
assert.equal(m.p3State(W(fx.MISSING)), null);
assert.deepEqual(m.p3State(W(fx.FINISHED_DUE), { failed: 'Lin is working here' }), { kind: 'failed', reason: 'Lin is working here' });
// D1: Clean now on a kept worktree shows the cleaned result, its kept notes and a toast.
const keptClean = { ...fx.FINISHED_DUE, keep_build: true, clean_at: null, cleaned_at: '2026-11-10T15:10:00Z', cleaned: ['node_modules', 'web/dist'], cleaned_bytes: 300_000, kept: [{ dir: 'dist', why: 'tracked' }] };
- assert.deepEqual(m.p3State(W(keptClean)), { kind: 'cleaned', size: '300 KB', at: '15:10', dirs: ['node_modules', 'dist'] });
+ assert.deepEqual(m.p3State(W(keptClean)), { kind: 'cleaned', size: '300 KB', at: '3:10 PM', dirs: ['node_modules', 'dist'] });
assert.deepEqual(m.keptNotes(W(keptClean)), ['Kept dist: Git tracks a file in it.']);
assert.equal(m.cleanToast(W(keptClean)), 'Cleaned 300 KB of build output. Kept dist: Git tracks a file in it.');
// A clean from before this finish doesn't hide "kept".
@@ -205,10 +205,10 @@ test('the list groups by repo with counts, rows in every state, and an empty rep
assert.match(text(w1), /↑2/);
assert.equal(w1.querySelector('[data-wt-act="remove"]').getAttribute('aria-disabled'), 'true');
assert.match(text(w1), /Pixel is working here\. Stop Pixel first\./);
- assert.match(text(row(host, 'w2')), /Lin finished 13:42/);
+ assert.match(text(row(host, 'w2')), /Lin finished 1:42 PM/);
assert.match(text(row(host, 'w2')), /up to date|↑4/);
assert.match(text(row(host, 'w4')), /You made by you try-vite-6/);
- assert.match(text(row(host, 'w4')), /No task\. Made from the Dev desk 09:12/);
+ assert.match(text(row(host, 'w4')), /No task\. Made from the Dev desk 9:12 AM/);
assert.match(text(row(host, '/home/ann/code/shop-hotfix')), /shop-hotfix made outside kwant hotfix\/1\.4\.2/);
assert.equal(row(host, '/home/ann/code/shop-hotfix').querySelector('[data-wt-act="remove"]'), null, 'outside rows are read-only');
const site = host.querySelector('[data-wt-repo="site"]');
@@ -222,7 +222,7 @@ test('P3 line: Keep it, then Clean now; a refused clean says why and nothing els
const host = await mount();
const p3 = () => row(host, 'w2').querySelector('[data-wt-p3]');
assert.equal(p3().dataset.wtP3, 'due');
- assert.match(text(p3()), /Build output is cleaned at 14:42 · Keep it/);
+ assert.match(text(p3()), /Build output is cleaned at 2:42 PM · Keep it/);
await click(p3().querySelector('[data-wt-keep]'));
assert.deepEqual(calls.at(-2).body ?? calls.find((c) => c.url.endsWith('/keep')).body, { keep: true });
assert.equal(p3().dataset.wtP3, 'kept');
@@ -230,7 +230,7 @@ test('P3 line: Keep it, then Clean now; a refused clean says why and nothing els
assert.equal(p3().dataset.wtP3, 'failed');
assert.match(text(p3()), /Couldn’t clean build output: Lin is working here\. Nothing else was touched\. · Try again/);
const cleaned = row(host, 'w3').querySelector('[data-wt-p3]');
- assert.match(text(cleaned), /Cleaned 1\.2 GB of build output at 18:40 \(\.vite, target\) · Kept dist: Git tracks a file in it\./);
+ assert.match(text(cleaned), /Cleaned 1\.2 GB of build output at 6:40 PM \(\.vite, target\) · Kept dist: Git tracks a file in it\./);
});
test('D1: Clean now on a kept worktree shows the cleaned line, its kept notes and a toast', async () => {
@@ -245,7 +245,7 @@ test('D1: Clean now on a kept worktree shows the cleaned line, its kept notes an
await click(p3().querySelector('[data-wt-clean]'));
assert.ok(calls.some((c) => c.method === 'POST' && c.url.endsWith('/w2/clean')));
assert.equal(p3().dataset.wtP3, 'cleaned');
- assert.match(text(p3()), /Cleaned 300 KB of build output at 15:10 \(node_modules\) · Kept dist: Git tracks a file in it\./);
+ assert.match(text(p3()), /Cleaned 300 KB of build output at 3:10 PM \(node_modules\) · Kept dist: Git tracks a file in it\./);
assert.match(text(host.querySelector('[data-wt-toast]')), /^Cleaned 300 KB of build output\. Kept dist: Git tracks a file in it\.$/);
});