cheogram-www
created pr with
cheogram-www/call-log-dates.1
commented
lgtm
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-www:call-log-dates | git am -3checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-www:call-log-dates [rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-www:call-log-datesadd comment to patch request:
ssh pr.pico.sh comment cheogram-www:call-log-dates "lgtm!"
Patchset
cheogram-www/call-log-dates.1
Same date/time format for bubbles and call logs
Stephen Paul Weber
2026-11-07T20:44:56ZSemantic diff summary
1 added,
3 modified,
0 signature changed,
1 removed
across 3 analyzed files
+2
-1
src/components/CallMessage.tsx
#
| ... | ... | @@ -3,6 +3,7 @@ import { MessageDebugger } from "./MessageDebugger"; | |
| 3 | 3 | import CallMissed from "@mui/icons-material/CallMissed"; | |
| 4 | 4 | import CallMade from "@mui/icons-material/CallMade"; | |
| 5 | 5 | import CallReceived from "@mui/icons-material/CallReceived"; | |
| 6 | + | import { shortDateTimeOnlyToday } from "../util"; | |
| 6 | 7 | ||
| 7 | 8 | export const CallMessage = ({ m }: { m: borogove.ChatMessage }) => { | |
| 8 | 9 | const missedCall = m.callStatus() === "retract"; |
| ... | ... | @@ -24,7 +25,7 @@ export const CallMessage = ({ m }: { m: borogove.ChatMessage }) => { | |
| 24 | 25 | ") ยท ", | |
| 25 | 26 | ]} | |
| 26 | 27 | <time dateTime={m.timeSent}> | |
| 27 | - | {new Date(m.timeSent).toLocaleString([], { timeStyle: "short" })} | |
| 28 | + | {shortDateTimeOnlyToday(new Date(m.timeSent))} | |
| 28 | 29 | </time> | |
| 29 | 30 | </div> | |
| 30 | 31 | ); |
+1
-10
src/components/MessageBubble.tsx
#
| ... | ... | @@ -8,6 +8,7 @@ import { useNavigate } from "react-router"; | |
| 8 | 8 | import { MessageAttachments } from "./MessageAttachments"; | |
| 9 | 9 | import { ReactNode, useRef, useLayoutEffect, useState } from "react"; | |
| 10 | 10 | import hljs from "highlight.js"; | |
| 11 | + | import { shortDateTimeOnlyToday } from "../util"; | |
| 11 | 12 | import { | |
| 12 | 13 | Dialog, | |
| 13 | 14 | DialogContent, |
| ... | ... | @@ -25,16 +26,6 @@ import { | |
| 25 | 26 | faReply, | |
| 26 | 27 | } from "@fortawesome/free-solid-svg-icons"; | |
| 27 | 28 | ||
| 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 | - | ||
| 38 | 29 | const renderReaction = (reaction: borogove.Reaction) => { | |
| 39 | 30 | return reaction.render<JSX.Element | string>( | |
| 40 | 31 | (text: string) => text, |
+10
-0
src/util.ts
#
| ... | ... | @@ -208,3 +208,13 @@ export const membersForMessages = async ( | |
| 208 | 208 | ||
| 209 | 209 | return result; | |
| 210 | 210 | }; | |
| 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 | + | } |