关于发帖时间和回复时间的显示建议
資深大佬 : katsusan 11
一个小小的建议,V2 的发帖时间目前都是类似于 h 小时 m 分钟前的格式,这样想知道确切时间的话还得自己算一下
(比如看到一个 780 天前的历史帖子没法直观看出是何时发布的),能否像 github 那样鼠标放上去显示标准的时间格式。
我参考了下 v2 和 github 的 html 元素,这样改在 chrome 下好像是可以的。
具体时间服务端渲染的时候应该可以根据 unix 时间戳算出来。希望 livid 大佬有空能改进一下,感谢。
// current V2EX topic_info style
<span class="topic_info"> <div class="votes"></div> <a class="node" href="/go/jobs">酷工作</a> • <strong><a href="/member/ethandyr">ethandyr</a></strong> • 1 小时 10 分钟前 • 最后回复来自 <strong><a href="/member/yanzhiling2001">yanzhiling2001</a></strong> </span>
// V2EX topic_info with showing absolute time when mouse hovered
<span class="topic_info"> <div class="votes"></div> <a class="node" href="/go/jobs">酷工作</a> • <strong><a href="/member/ethandyr">ethandyr</a></strong> • <span title="2020 年 12 月 9 日 GMT+8 01:18:32">1 小时 10 分钟前</span> • 最后回复来自 <strong><a href="/member/yanzhiling2001">yanzhiling2001</a></strong> </span>
// github 相对时间的 html 元素
<span class="f6 text-gray-light no-wrap ml-1"> <relative-time datetime="2020-12-08T15:28:22Z" class="no-wrap" title="2020 年 12 月 8 日 GMT+8 下午 11:28">2 hours ago</relative-time> </span>
大佬有話說 (4)