MCPcopy Create free account
hub / github.com/agegr/pi-web / formatTime

Function formatTime

components/MessageView.tsx:73–84  ·  view source on GitHub ↗
(ts?: number)

Source from the content-addressed store, hash-verified

71}
72
73function formatTime(ts?: number): string | null {
74 if (!ts) return null;
75 const d = new Date(ts);
76 const now = new Date();
77 const isToday = d.getFullYear() === now.getFullYear() &&
78 d.getMonth() === now.getMonth() &&
79 d.getDate() === now.getDate();
80 const time = d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
81 if (isToday) return time;
82 const date = d.toLocaleDateString([], { month: "short", day: "numeric", year: d.getFullYear() !== now.getFullYear() ? "numeric" : undefined });
83 return `${date} ${time}`;
84}
85
86function haveSameRelevantToolResults(
87 message: AgentMessage,

Callers 4

UserMessageViewFunction · 0.85
AssistantMessageViewFunction · 0.85
CompactionMessageViewFunction · 0.85
CustomMessageViewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected