diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-08-17 23:29:04 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-08-17 23:29:04 +0000 |
commit | 4105941a91047cd63969db7c5632a8a3893f9c3b (patch) | |
tree | b4cfed31bd2df6dec425e51effefc323bc930979 | |
parent | 3b14b3a0377cb504777e1a003f63957633d2730d (diff) | |
parent | b16011a1cd610398cf553c012878aec1ef5b2683 (diff) | |
download | dashboard-4105941a91047cd63969db7c5632a8a3893f9c3b.tar.gz |
Merge "Always show date in rendered timestamps."
-rw-r--r-- | src/main/webapp/WEB-INF/jsp/show_table.jsp | 11 | ||||
-rw-r--r-- | src/main/webapp/js/time.js | 7 |
2 files changed, 5 insertions, 13 deletions
diff --git a/src/main/webapp/WEB-INF/jsp/show_table.jsp b/src/main/webapp/WEB-INF/jsp/show_table.jsp index 392ed54..4958b4a 100644 --- a/src/main/webapp/WEB-INF/jsp/show_table.jsp +++ b/src/main/webapp/WEB-INF/jsp/show_table.jsp @@ -25,6 +25,7 @@ <script type='text/javascript' src='https://www.gstatic.com/charts/loader.js'></script> <script src='https://www.gstatic.com/external_hosted/moment/min/moment-with-locales.min.js'></script> <script src='js/search_header.js'></script> + <script src='js/time.js'></script> <script type='text/javascript'> google.charts.load('current', {'packages':['table', 'corechart']}); google.charts.setOnLoadCallback(drawGridTable); @@ -195,13 +196,7 @@ timeGrid = timeGrid.map(function(row) { return row.map(function(cell, j) { if (j == 0) return cell; - var time = moment(cell/1000); - // If today, don't display the date - if (time.isSame(moment(), 'd')) { - return time.format('H:mm:ssZZ'); - } else { - return time.format('M/D/YY H:mm:ssZZ'); - } + return moment().renderTime(cell); }); }); @@ -209,7 +204,7 @@ durationGrid = durationGrid.map(function(row) { return row.map(function(cell, j) { if (j == 0) return cell; - return moment.utc(cell/1000).format("HH:mm:ss.SSS"); + return moment().renderDuration(cell); }); }); diff --git a/src/main/webapp/js/time.js b/src/main/webapp/js/time.js index dc8c4d6..6178eda 100644 --- a/src/main/webapp/js/time.js +++ b/src/main/webapp/js/time.js @@ -24,10 +24,7 @@ */ moment.prototype.renderTime = function (timestamp, showTimezone) { var time = moment(timestamp / 1000); - var format = 'H:mm:ss'; - if (!time.isSame(moment(), 'd')) { - format = 'YY/M/DD ' + format; - } + var format = 'YYYY-M-DD H:mm:ss'; if (!!showTimezone) { format = format + 'ZZ'; } @@ -42,7 +39,7 @@ */ moment.prototype.renderDate = function (timestamp, showTimezone) { var time = moment(timestamp / 1000); - var format = 'YY/M/DD'; + var format = 'YYYY-M-DD'; if (!!showTimezone) { format = format + 'ZZ'; } |