请参阅github中的“真实”提交date(小时/天)

有没有办法看到github提交date,日/小时的精度? 较旧的提交以“人可读”格式出现,如“2年前”,而不是显示实际date。

旧的github提交

如果不可能在github上看到实际的date,是否有一个比git clone更简单的解决方法?

hover在2 years ago ,你会得到时间戳。

真正的date不会出现在我hover“2年前”,尽pipe文本被一个<time>元素与其datetime属性下的iso值包装。

如果一切都失败了,像我这样做,请尝试检查文本。

示例元素:

<time datetime="2015-01-22T20:48:13Z" is="relative-time" title="Jan 22, 2015, 2:48 PM CST">7 days ago</time>

你可以使用这个js书签:

 javascript:(function() { var relativeTimeElements = window.document.querySelectorAll("relative time"); relativeTimeElements.forEach(function(timeElement){ timeElement.innerHTML = timeElement.innerHTML +" -- "+ timeElement.title; }) }() ) 

https://gist.github.com/PhilippGrulich/7051832b344d4cbd30fbfd68524baa38

它增加了正确的时间:像这样:21小时前提交 – 2017年2月15日,15:49 MEZ

使用gitlab 10,我使用它将标题文本的工具提示标题添加到元素中:

 javascript:(function() { var relativeTimeElements = window.document.querySelectorAll("time"); relativeTimeElements.forEach(function(timeElement){ timeElement.innerHTML = timeElement.innerHTML +" -- "+ timeElement.getAttribute('data-original-title'); }) }()); 

如果您正在寻找一种永久显示date/时间的方法(例如截图),则上述基于Javascript的解决scheme与最新的Github HTML(见注释)不匹配。 而且他们没有考虑到时间戳是基于计时器自动更新的事实( “X分钟前”必须每分钟更改一次),所以他们会周期性地重新出现。

以下脚本似乎在2017年10月30日之前在Github上运行:

 (function() { var els = window.document.querySelectorAll("time-ago,relative-time"); els.forEach(function(el) { el.innerHTML = el._date; // set original timestamp el.detachedCallback(); // stop auto-updates }); })(); 

您可以通过在javascript:加上代码来使它成为一个书签 javascript:就像在另一个基于JS的解决scheme中一样。

如果您想要将其作为永久修复程序,可以将其保存为TamperMonkey / Greasemonkey脚本,如下所示:

 // ==UserScript== // @name Github: always show absolute times // @match https://github.com/* // ==/UserScript== (function() { var els = window.document.querySelectorAll("time-ago,relative-time"); els.forEach(function(el) { el.innerHTML = el._date; // set original timestamp el.detachedCallback(); // stop auto-updates }); })();