summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorRyan Campbell <ryanjcampbell@google.com>2017-08-17 23:46:16 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-08-17 23:46:16 +0000
commitbf87c647f9907b73df940150bd2ea98c99329e10 (patch)
treeb4cfed31bd2df6dec425e51effefc323bc930979 /src/main
parent82d804ec6de2099c4ec671a00812e7475cebbf78 (diff)
parent4105941a91047cd63969db7c5632a8a3893f9c3b (diff)
downloaddashboard-bf87c647f9907b73df940150bd2ea98c99329e10.tar.gz
Merge "Always show date in rendered timestamps."
am: 4105941a91 Change-Id: Ic2ae45b1e29efdd5b7ddb5b08289493f742b7d7f
Diffstat (limited to 'src/main')
-rw-r--r--src/main/webapp/WEB-INF/jsp/show_table.jsp11
-rw-r--r--src/main/webapp/js/time.js7
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';
}