diff --git a/src/components/ChatPanel.tsx b/src/components/ChatPanel.tsx index 78bd80e..1555e7b 100644 --- a/src/components/ChatPanel.tsx +++ b/src/components/ChatPanel.tsx @@ -310,7 +310,16 @@ export default function ChatPanel({ chatId, projectId }: Props) { : (msg.author?.name || msg.author?.slug || "Unknown")} · - {new Date(msg.created_at).toLocaleString("ru-RU", { hour: "2-digit", minute: "2-digit" })} + {(() => { + const d = new Date(msg.created_at); + const now = new Date(); + const isToday = d.toDateString() === now.toDateString(); + const time = d.toLocaleString("ru-RU", { hour: "2-digit", minute: "2-digit" }); + if (isToday) return time; + const yesterday = new Date(now); yesterday.setDate(now.getDate() - 1); + if (d.toDateString() === yesterday.toDateString()) return `вчера, ${time}`; + return d.toLocaleString("ru-RU", { day: "numeric", month: "short" }) + `, ${time}`; + })()} {msg.thinking && (