Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Unified Diff: milo/appengine/frontend/static/common/js/time.js

Issue 2691003002: Display "(local time)" label after start/end time of the build (Closed)
Patch Set: Addressed comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/frontend/static/common/js/time.js
diff --git a/milo/appengine/frontend/static/common/js/time.js b/milo/appengine/frontend/static/common/js/time.js
index c2e1da0c78f19280456680ed370683c7ab4994a9..7030c3b8b589b3b7a31b901ee491615a4d8f6282 100644
--- a/milo/appengine/frontend/static/common/js/time.js
+++ b/milo/appengine/frontend/static/common/js/time.js
@@ -18,15 +18,22 @@
return null;
}
var shortDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
- var offset = -(new Date()).getTimezoneOffset();
- var offsetHr = Math.abs(Math.round(offset / 60));
- var offsetMin = Math.abs(Math.abs(offset) - (offsetHr * 60));
+
+ var offset = -t.getTimezoneOffset();
+ var offsetHr = Math.floor(Math.abs(offset) / 60);
+ var offsetMin = Math.abs(offset) % 60;
+ var offsetSign = '';
hinoka 2017/02/28 18:10:41 Don't need this anymore
Sergiy Byelozyorov 2017/03/01 08:35:04 Done.
if (offsetHr < 10) {
offsetHr = '0' + offsetHr;
}
if (offsetMin < 10) {
offsetMin = '0' + offsetMin;
}
+ if (offset < 0) {
hinoka 2017/02/28 18:10:41 Or this
Sergiy Byelozyorov 2017/03/01 08:35:04 Done.
+ offsetSign = '-';
+ } else if (offset > 0) {
+ offsetSign = '+';
+ }
var month = (t.getMonth() + 1);
if (month < 10) {
@@ -38,7 +45,7 @@
}
var s = shortDayNames[t.getDay()] + ', ';
s += t.getFullYear() + '-' + month + '-' + date + ' ';
- s += t.toLocaleTimeString();
+ s += t.toLocaleTimeString() + ' (local time)';
return s;
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698