Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim down time display to hour:min:second #7103

Merged
merged 1 commit into from Mar 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 4 additions & 14 deletions prow/cmd/deck/static/script.js
Expand Up @@ -167,13 +167,6 @@ window.onload = function () {
Object.keys(opts["jobs"]).sort());
redrawOptions(opts);
redraw();
var timeCells = document.querySelectorAll(".time-cell");
setInterval(() => {
timeCells.forEach(timeCell => {
var origin = parseInt(timeCell.getAttribute("data-time"));
timeCell.textContent = moment.unix(origin).format('MMM DD YYYY, HH:MM:SS [GMT]ZZ');
}, 60000);
});
};

document.addEventListener("DOMContentLoaded", function (event) {
Expand Down Expand Up @@ -492,17 +485,14 @@ function createTimeCell(id, time) {
var momentTime = moment.unix(time);
var tid = "time-cell-" + id;
var main = document.createElement("div");
var age = momentTime.fromNow();
var timeString = momentTime.format('MMM DD YYYY, HH:MM:SS [GMT]ZZ');
main.textContent = timeString;
var isADayOld = momentTime.isBefore(moment().startOf('day'));
main.textContent = momentTime.format(isADayOld ? 'MMM DD HH:mm:ss' : 'HH:mm:ss');
main.id = tid;
main.setAttribute("data-time", time);
main.classList.add("time-cell");

var tooltip = document.createElement("div");
tooltip.textContent = age;
tooltip.textContent = momentTime.format('MMM DD YYYY, HH:mm:ss [UTC]ZZ');
tooltip.setAttribute("data-mdl-for", tid);
tooltip.classList.add("mdl-tooltip");
tooltip.classList.add("mdl-tooltip", "mdl-tooltip--large");

var c = document.createElement("td");
c.appendChild(main);
Expand Down