Do our own date parsing in console template graph controls.
Fixes #1442
This commit is contained in:
parent
a08943e6d3
commit
4dbe689632
File diff suppressed because one or more lines are too long
|
@ -198,7 +198,8 @@ PromConsole.TimeControl.prototype.getEndDate = function() {
|
||||||
if (this.endElement.value === '') {
|
if (this.endElement.value === '') {
|
||||||
return null;
|
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() {
|
PromConsole.TimeControl.prototype.getOrSetEndDate = function() {
|
||||||
|
@ -208,13 +209,13 @@ PromConsole.TimeControl.prototype.getOrSetEndDate = function() {
|
||||||
}
|
}
|
||||||
date = new Date();
|
date = new Date();
|
||||||
this.setEndDate(date);
|
this.setEndDate(date);
|
||||||
return date;
|
return date.getTime();
|
||||||
};
|
};
|
||||||
|
|
||||||
PromConsole.TimeControl.prototype.getHumanDate = function(date) {
|
PromConsole.TimeControl.prototype.getHumanDate = function(date) {
|
||||||
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
|
var hours = date.getUTCHours() < 10 ? '0' + date.getUTCHours() : date.getUTCHours();
|
||||||
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
|
var minutes = date.getUTCMinutes() < 10 ? '0' + date.getUTCMinutes() : date.getUTCMinutes();
|
||||||
return date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate() + " " +
|
return date.getUTCFullYear() + "-" + (date.getUTCMonth()+1) + "-" + date.getUTCDate() + " " +
|
||||||
hours + ":" + minutes;
|
hours + ":" + minutes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue