cheogram-www

created pr with cheogram-www/call-log-dates.1 on 2026-11-07T20:46:07Z · by 9e834e0d
commented on 2026-11-09T15:02:42Z · by 3c31bc8c
lgtm
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-www:call-log-dates | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-www:call-log-dates [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-www:call-log-dates
add comment to patch request:
ssh pr.pico.sh comment cheogram-www:call-log-dates "lgtm!"
+2 -1 src/components/CallMessage.tsx #
......@@ -3,6 +3,7 @@ import { MessageDebugger } from "./MessageDebugger";
33 import CallMissed from "@mui/icons-material/CallMissed";
44 import CallMade from "@mui/icons-material/CallMade";
55 import CallReceived from "@mui/icons-material/CallReceived";
6+import { shortDateTimeOnlyToday } from "../util";
67
78 export const CallMessage = ({ m }: { m: borogove.ChatMessage }) => {
89 const missedCall = m.callStatus() === "retract";
......@@ -24,7 +25,7 @@ export const CallMessage = ({ m }: { m: borogove.ChatMessage }) => {
2425 ") ยท ",
2526 ]}
2627 <time dateTime={m.timeSent}>
27- {new Date(m.timeSent).toLocaleString([], { timeStyle: "short" })}
28+ {shortDateTimeOnlyToday(new Date(m.timeSent))}
2829 </time>
2930 </div>
3031 );
+1 -10 src/components/MessageBubble.tsx #
......@@ -8,6 +8,7 @@ import { useNavigate } from "react-router";
88 import { MessageAttachments } from "./MessageAttachments";
99 import { ReactNode, useRef, useLayoutEffect, useState } from "react";
1010 import hljs from "highlight.js";
11+import { shortDateTimeOnlyToday } from "../util";
1112 import {
1213 Dialog,
1314 DialogContent,
......@@ -25,16 +26,6 @@ import {
2526 faReply,
2627 } from "@fortawesome/free-solid-svg-icons";
2728
28-function shortDateTimeOnlyToday(date: Date) {
29- const today =
30- new Date().toLocaleString([], { dateStyle: "short" }) ===
31- date.toLocaleString([], { dateStyle: "short" });
32- return date.toLocaleString([], {
33- dateStyle: today ? undefined : "short",
34- timeStyle: "short",
35- });
36-}
37-
3829 const renderReaction = (reaction: borogove.Reaction) => {
3930 return reaction.render<JSX.Element | string>(
4031 (text: string) => text,
+10 -0 src/util.ts #
......@@ -208,3 +208,13 @@ export const membersForMessages = async (
208208
209209 return result;
210210 };
211+
212+export function shortDateTimeOnlyToday(date: Date) {
213+ const today =
214+ new Date().toLocaleString([], { dateStyle: "short" }) ===
215+ date.toLocaleString([], { dateStyle: "short" });
216+ return date.toLocaleString([], {
217+ dateStyle: today ? undefined : "short",
218+ timeStyle: "short",
219+ });
220+}
Back to top