Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(comments): show dates on discussion and comment timestamps (#7298)

gbirmanba7878123711
diff --git a/apps/web/src/features/channel/Message/ChannelMessage.tsx b/apps/web/src/features/channel/Message/ChannelMessage.tsx
index 5e9ce27a31..4f1ffd081a 100644
--- a/apps/web/src/features/channel/Message/ChannelMessage.tsx
+++ b/apps/web/src/features/channel/Message/ChannelMessage.tsx
@@ -123,7 +123,10 @@ function RegularMessageLayout(props: {
<div class="flex items-baseline gap-1 min-w-0">
<Message.SenderName />
<Message.AgentBadge />
- <Message.Timestamp class="shrink-0" format="time" />
+ <Message.Timestamp
+ class="shrink-0"
+ format={props.parent.type === 'channel' ? 'time' : 'dateAndTime'}
+ />
<Message.EditedIndicator class="shrink-0" />
<Message.AgentSessionLink class="ml-auto" />
</div>
diff --git a/apps/web/src/lib/core/tests/date.test.ts b/apps/web/src/lib/core/tests/date.test.ts
index a6d7ddaf24..85d9de344a 100644
--- a/apps/web/src/lib/core/tests/date.test.ts
+++ b/apps/web/src/lib/core/tests/date.test.ts
@@ -92,6 +92,29 @@ describe('Date Utilities (core/utils/date.ts)', () => {
expect(formatDate(oldDate)).toBe('06/01/25');
});
+ it('shows the date for last week even before that time of day has passed', () => {
+ vi.setSystemTime(new Date('2026-10-01T17:08:00Z'));
+
+ expect(
+ formatDate('2026-09-24T20:37:53Z', {
+ timeZone: NEW_YORK_TZ,
+ showTime: true,
+ })
+ ).toBe('09/24/26 at 4:37 PM');
+ });
+
+ it('uses the display timezone for the seven-calendar-day cutoff', () => {
+ vi.setSystemTime(new Date('2026-10-01T02:00:00Z'));
+ const lastWeek = '2026-09-24T04:00:00Z';
+
+ expect(formatDate(lastWeek, { showTime: true })).toBe(
+ '09/24/26 at 4:00 AM'
+ );
+ expect(
+ formatDate(lastWeek, { timeZone: NEW_YORK_TZ, showTime: true })
+ ).toBe('Thursday at 12:00 AM');
+ });
+
it('should handle timezone-aware day boundaries', () => {
// Reference: June 14, 2025 at 2:15 PM UTC
// Test timestamp: June 14 at 11:30 PM Eastern (3:30 AM UTC June 15)
diff --git a/apps/web/src/lib/core/util/date.ts b/apps/web/src/lib/core/util/date.ts
index b52ca3ed32..12fd717567 100644
--- a/apps/web/src/lib/core/util/date.ts
+++ b/apps/web/src/lib/core/util/date.ts
@@ -2,7 +2,7 @@ import { tz } from '@date-fns/tz';
import {
compareAsc,
compareDesc,
- differenceInWeeks,
+ differenceInCalendarDays,
isToday,
isYesterday,
toDate,
@@ -82,7 +82,7 @@ export const formatDate = (
return `${shortWeekday ? 'Yest' : 'Yesterday'} at ${time}`;
}
- if (differenceInWeeks(now, date) < 1) {
+ if (differenceInCalendarDays(now, d, timeZoneOpts) < 7) {
const weekday = d.toLocaleDateString(undefined, {
weekday: shortWeekday ? 'short' : 'long',
timeZone,
diff --git a/docs/AGENT_GUIDE/documents.md b/docs/AGENT_GUIDE/documents.md
index 447a833b72..41dfbb9309 100644
--- a/docs/AGENT_GUIDE/documents.md
+++ b/docs/AGENT_GUIDE/documents.md
@@ -580,6 +580,10 @@ preview replies per thread. Expand a thread to load its replies;
`Load earlier comments` pages backward. Live updates preserve unsent replies
and edits while updating the surrounding thread.
+Discussion and comment headers include the date for older messages (for example,
+`Yesterday at 4:37 PM` or `09/24/26 at 4:37 PM`). Regular channel timelines retain
+their date dividers and time-only message headers.
+
When verifying `@` mentions, compare the same person query in the document body
and the Discussion composer: shared contacts use the same recent-interaction
ranking. The desktop menu keeps up to three People results visible while other