Also ensures it makes available the hydra timezone in the title of the dates.
ORWUR47ZCFUFUU2LX7SEBTZA7R2ET4WSBX5F4BGEIRWIYHSHV4SQC
XA4U3RP6AQP665FQDVCGTZW2UXQQAT7W2M7GHP7OXVTCO6TQRZ7QC
EPWEMRI23UN6C777AL2GWEOXYZRTPEPFC2SZVZ4JTWUGYVFDL5XAC
E5DMQRPO5BQ6KNA3C34U5JQQ5ZAZOJE2HTWM3JUVIG42LAVHPHFQC
H7CNGK4OJNRYZQGPLBGR72DULLEPFQ5UISF5J24D7IMA7SYW5LGQC
IK53RV4VGOHLCZGQCCIKPB45M3C7M7YMNBOJFBGZJ4LWIZNU4QNQC
4WZQW2N6NJSIKSK7DCOV2YVEG5C45LLUM2FCCZRLISUXUGMBGF6QC
6KIJX24R5RRDR2UQMUAWHF3N6V6DKKL5URYSLB7IT4J5C3RO4G2AC
PMTIAQEPKFUZSK7HGDHGLFXNXOPVDTZV35JS7COVEKPVIPS7LUIAC
GNIEG2GCT6BUYHY2WXUAQVKHSYB6TVQT52O5GEY6COLKFK4ODCCQC
J5UVLXOK6EDIL5I7VKWH4V2QDS4DPD7FHRK6XBWSXFRQS4JKXFZQC
KSBB33RE2PK5SFN7ZMOTZJQHZB4JYIIUUKWDSD3LSZ5GD465AJHQC
2P7VNAACFSXMH42JCXQZ7GDAAEIFDGDWJOK6XD6G36AGEYQSRO2AC
# HTML-rendered date. Formatted in hydra-local timezone.
# It is enhanced with JavaScript to show user-local and UTC time zones.
BLOCK renderDateTime %]
<time [% HTML.attributes(
"data-timestamp" => timestamp,
title => date.format(timestamp, '%Y-%m-%d %H:%M:%S (%Z)'),
datetime => date.format(timestamp, "%Y-%m-%dT%H:%M:%SZ", gmt => 1),
) %] class="date is-absolute">
[% INCLUDE dateTimeText %]
</time>
[% END;
# HTML-rendered relative date.
# It is enhanced with JavaScript to show user-local and UTC time zones.
BLOCK renderRelativeDate %]
<time [% HTML.attributes(
"data-timestamp" => timestamp,
title => date.format(timestamp, '%Y-%m-%d %H:%M:%S (%Z)'),
datetime => date.format(timestamp, "%Y-%m-%dT%H:%M:%SZ", gmt => 1),
) %] class="date is-relative">
[% INCLUDE relativeDateText %]
</time>
[% END;
.date {
cursor: help;
border-bottom: 1px dotted #999;
}
/* Makes dates more user friendly. */
// Friendly date format
var DATE_FORMAT = "YYYY-MM-DD HH:mm:ss";
// Local timezone offset to display.
var tz = moment().format("Z");
$("time.date").each(function(i, el) {
var el = $(el);
var localTime = moment(el.data("timestamp"), "%X");
var hydraTime = el.attr("title");
if (el.hasClass("is-absolute")) {
el.attr( "title", [
"Adjusted to local time (" + tz + ")",
"Other timezones:",
" UTC: " + localTime.clone().utc().format(DATE_FORMAT),
" As Hydra reported: " + hydraTime,
].join("\n"));
el.text(localTime.format(DATE_FORMAT));
el.addClass("is-local");
}
else if (el.hasClass("is-relative")) {
el.attr( "title", [
"Local (" + tz + "): " + localTime.format(DATE_FORMAT),
"UTC: " + localTime.clone().utc().format(DATE_FORMAT),
"As Hydra reported: " + hydraTime,
].join("\n"));
el.addClass("is-local");
}
});