feat(meshcore): Last Heard shows date when heard before today (#3656)#3663
Conversation
…re today (#3656) On the MeshCore Nodes list, Last Heard always rendered a time (`toLocaleTimeString`), which is ambiguous for nodes last heard on a prior day. Now: if last heard today (local day) show the time as before; if before today show the date, formatted per the user's Date Format setting. Adds a small `formatTimeOrDate(date, timeFormat, dateFormat)` helper to datetime.ts (reuses the existing formatTime/formatDate) and wires it into MeshCoreNodesView via the timeFormat/dateFormat settings. "Today" is the local calendar day, consistent with how times are otherwise displayed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011JEaCGwY9Wz8jeV4e22GW4
|
Claude finished @Yeraze's task —— View job PR Review
Overall this is a clean, well-scoped fix. The implementation is correct and the logic is easy to follow. A few observations:
|
| Correctness | ✅ Logic is correct; today/before-today boundary is handled properly |
| Code quality | ✅ Minimal, readable, follows existing patterns |
| Performance | ✅ No concerns — two new Date() calls per rendered row at most |
| Security | ✅ No concerns |
| Test coverage | describe blocks in the test file should be removed; a future-date test and an integration rendering test would strengthen confidence |
The duplicate describe blocks are the only concrete change I'd request before merging.
…3656) Node 20's ICU renders 24h local midnight as '24:00' (newer Node gives '00:00'), which failed the midnight boundary assertion only on Test Suite (20.x). The intent is to verify midnight-today renders as a TIME (not a date), so match a time pattern instead of pinning the exact value. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011JEaCGwY9Wz8jeV4e22GW4
|
Claude finished @Yeraze's task —— View job PR Review
Overall this is a clean, well-scoped fix. The implementation is correct and the logic is easy to follow.
|
| Area | Status |
|---|---|
| Correctness | ✅ Logic is correct; today/before-today boundary handled properly |
| Code quality | ✅ Minimal, readable, follows existing patterns |
| Performance | ✅ No concerns |
| Security | ✅ No concerns |
| Test coverage | describe blocks should be removed (fix committed locally but push blocked by permissions — see above) |
Summary
Closes #3656.
On the MeshCore Nodes list, the Last Heard label always rendered a time (
toLocaleTimeString), which is ambiguous for a node last heard on a previous day. Now:Implementation
formatTimeOrDate(date, timeFormat, dateFormat)insrc/utils/datetime.ts— reuses the existingformatTime/formatDate. "Today" is the local calendar day, consistent with how times are otherwise displayed (no server-TZ plumbing — the rest of the UI also renders local time).MeshCoreNodesViewviatimeFormat/dateFormatfromuseSettings.(
formatMessageTimewas not reused — it appends a time even to old dates and uses "Yesterday"/day-name forms, which is not this issue's spec.)Testing
datetime.test.ts— today→time (12h/24h), before-today→date across all three Date Formats, and the local-midnight / 23:59-yesterday boundaries.MeshCoreNodesView.test.tsxupdated (mockuseSettings); full MeshCore node-view suite green (53 tests).tscclean.🤖 Generated with Claude Code