Browse Source

Do our own date parsing in console template graph controls.

Fixes #1442
pull/1721/head
Brian Brazil 9 years ago
parent
commit
4dbe689632
  1. 74
      web/ui/bindata.go
  2. 11
      web/ui/static/js/prom_console.js

74
web/ui/bindata.go

File diff suppressed because one or more lines are too long

11
web/ui/static/js/prom_console.js

@ -198,7 +198,8 @@ PromConsole.TimeControl.prototype.getEndDate = function() {
if (this.endElement.value === '') {
return null;
}
return new Date(this.endElement.value).getTime();
var dateParts = this.endElement.value.split(/[- :]/)
return Date.UTC(dateParts[0], dateParts[1] - 1, dateParts[2], dateParts[3], dateParts[4]);
};
PromConsole.TimeControl.prototype.getOrSetEndDate = function() {
@ -208,13 +209,13 @@ PromConsole.TimeControl.prototype.getOrSetEndDate = function() {
}
date = new Date();
this.setEndDate(date);
return date;
return date.getTime();
};
PromConsole.TimeControl.prototype.getHumanDate = function(date) {
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
return date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate() + " " +
var hours = date.getUTCHours() < 10 ? '0' + date.getUTCHours() : date.getUTCHours();
var minutes = date.getUTCMinutes() < 10 ? '0' + date.getUTCMinutes() : date.getUTCMinutes();
return date.getUTCFullYear() + "-" + (date.getUTCMonth()+1) + "-" + date.getUTCDate() + " " +
hours + ":" + minutes;
};

Loading…
Cancel
Save