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

Unified Diff: appengine/swarming/ui/res/imp/botpage/bot-page-data.html

Issue 2832423003: Fix Swarming UI timezone bug (Closed)
Patch Set: Fix copy-pasta and use sk.human Created 3 years, 8 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
Index: appengine/swarming/ui/res/imp/botpage/bot-page-data.html
diff --git a/appengine/swarming/ui/res/imp/botpage/bot-page-data.html b/appengine/swarming/ui/res/imp/botpage/bot-page-data.html
index 1030bd34960a4ef9d4c6ebbfdfc75287b5c92824..3acc1aa9948487ab3e0b6b002f0056dd4a45a818 100644
--- a/appengine/swarming/ui/res/imp/botpage/bot-page-data.html
+++ b/appengine/swarming/ui/res/imp/botpage/bot-page-data.html
@@ -58,18 +58,6 @@
var BOT_TIMES = ["first_seen_ts", "last_seen_ts", "lease_expiration_ts"];
var TASK_TIMES = ["started_ts", "completed_ts", "abandoned_ts", "modified_ts"];
- var timezone;
- function formatDate(date) {
- if (!timezone) {
- // Date.toString() looks like "Mon Aug 29 2016 09:03:41 GMT-0400 (EDT)"
- // we want to extract the time zone part and append it to the
- // locale time.
- var str = date.toString();
- timezone = str.substring(str.indexOf("("));
- }
- return date.toLocaleString() + " " + timezone;
- }
-
Polymer({
is: 'bot-page-data',
@@ -184,10 +172,7 @@
});
BOT_TIMES.forEach(function(time) {
- if (bot[time]) {
- bot[time] = new Date(bot[time]);
- bot["human_"+time] = formatDate(bot[time]);
- }
+ swarming.sanitizeAndHumanizeTime(bot, time);
});
return bot;
},
@@ -199,10 +184,7 @@
var events = events.items;
events.forEach(function(event){
// Do any preprocessing here
- if (event.ts) {
- event.ts = new Date(event.ts);
- event.human_ts = formatDate(event.ts);
- }
+ swarming.sanitizeAndHumanizeTime(event, "ts");
});
// Sort the most recent events first.
@@ -222,10 +204,7 @@
tasks.forEach(function(task){
// Do any preprocessing here
TASK_TIMES.forEach(function(time) {
- if (task[time]) {
- task[time] = new Date(task[time]);
- task["human_"+time] = formatDate(task[time]);
- }
+ swarming.sanitizeAndHumanizeTime(task, time);
});
if (task.duration) {

Powered by Google App Engine
This is Rietveld 408576698