Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Stop relative times reading "agoago" (CHOO-3904)

Simon Flack402d4133207c
diff --git a/console/apps/switch-console-desktop/src/renderer/lib/ui/relative-time.test.ts b/console/apps/switch-console-desktop/src/renderer/lib/ui/relative-time.test.ts
new file mode 100644
index 000000000..392e527eb
--- /dev/null
+++ b/console/apps/switch-console-desktop/src/renderer/lib/ui/relative-time.test.ts
@@ -0,0 +1,44 @@
+import { createElement } from 'react';
+import { renderToStaticMarkup } from 'react-dom/server';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { RelativeTime } from './relative-time';
+
+const NOW = new Date('2026-10-28T12:00:00Z');
+
+function renderText(props: Parameters<typeof RelativeTime>[0]): string {
+ const html = renderToStaticMarkup(createElement(RelativeTime, props));
+ return html.replace(/<[^>]+>/g, '');
+}
+
+describe('RelativeTime', () => {
+ beforeEach(() => {
+ vi.useFakeTimers();
+ vi.setSystemTime(NOW);
+ });
+
+ afterEach(() => {
+ vi.useRealTimers();
+ });
+
+ const fiveMinutesAgo = new Date(NOW.getTime() - 5 * 60_000);
+
+ it('says "ago" once in the full form', () => {
+ expect(renderText({ value: fiveMinutesAgo })).toBe('5 minutes ago');
+ });
+
+ it('says "ago" once in the full form when asked for it', () => {
+ expect(renderText({ value: fiveMinutesAgo, ago: true })).toBe('5 minutes ago');
+ });
+
+ it('leaves "ago" off the compact form unless asked', () => {
+ expect(renderText({ value: fiveMinutesAgo, compact: true })).toBe('5m');
+ });
+
+ it('adds "ago" to the compact form when asked', () => {
+ expect(renderText({ value: fiveMinutesAgo, compact: true, ago: true })).toBe('5m ago');
+ });
+
+ it('does not add "ago" to "now" in the compact form', () => {
+ expect(renderText({ value: NOW, compact: true, ago: true })).toBe('now');
+ });
+});
diff --git a/console/apps/switch-console-desktop/src/renderer/lib/ui/relative-time.tsx b/console/apps/switch-console-desktop/src/renderer/lib/ui/relative-time.tsx
index 1b8757b1a..f32a4e0f9 100644
--- a/console/apps/switch-console-desktop/src/renderer/lib/ui/relative-time.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/lib/ui/relative-time.tsx
@@ -6,6 +6,10 @@ type RelativeTimeProps = {
className?: string;
/** Renders an abbreviated form (e.g. "3d", "5mo") with a tooltip showing the full text. */
compact?: boolean;
+ /**
+ * Adds "ago" to the compact form ("3d ago"). The full form always reads
+ * "3 days ago", so this has no effect there.
+ */
ago?: boolean;
};
@@ -65,7 +69,6 @@ export const RelativeTime: React.FC<RelativeTimeProps> = ({ value, className, co
return (
<time className={className} dateTime={date.toISOString()}>
{label}
- {ago && 'ago'}
</time>
);
};