You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

22 lines
710 B

$(function () {
function switchDateFormat(format) {
$("#log td.datetime").each(function(index, cell) {
var dt = moment(cell.getAttribute("data-raw"));
format == "local" ? dt.local() : dt.utc();
$(".date", cell).text(dt.format("MMM D"));
$(".time", cell).text(dt.format("HH:mm"));
})
}
$("#format-switcher").click(function(ev) {
var format = ev.target.getAttribute("data-format");
switchDateFormat(format);
});
switchDateFormat("local");
// The table is initially hidden to avoid flickering as we convert dates.
// Once it's ready, set it to visible:
$("#log").css("visibility", "visible");
});