Files
puppetboard/puppetboard/static/js/timestamps.js
2014-03-13 12:02:34 +01:00

24 lines
554 B
JavaScript

jQuery(function ($) {
var localise_timestamp = function(timestamp){
if (timestamp === "None"){
return '';
};
d = moment.utc(timestamp);
d.local();
return d;
};
$("[rel=utctimestamp]").each(
function(index, timestamp){
var tstamp = $(timestamp);
var tstring = tstamp.text().trim();
var result = localise_timestamp(tstring);
if (result == '') {
tstamp.text('Unknown');
} else {
tstamp.text(localise_timestamp(tstring).format('MMM DD YYYY - HH:mm:ss'));
};
});
});