Commit 2cb83cf1 by carl bergquist

style(graph.tooltip): moves checkdate logic inside each method.

I find it easier to follow and checkdate didnt do much.
parent 8c02a7bd
...@@ -214,9 +214,7 @@ function (angular, $, _, moment) { ...@@ -214,9 +214,7 @@ function (angular, $, _, moment) {
}; };
p.formatDate = function(date, format) { p.formatDate = function(date, format) {
date = moment.isMoment(date) ? date : moment(date);
date = this.checkDate(date);
format = format || 'YYYY-MM-DD HH:mm:ss'; format = format || 'YYYY-MM-DD HH:mm:ss';
return this.timezone === 'browser' ? return this.timezone === 'browser' ?
...@@ -225,21 +223,13 @@ function (angular, $, _, moment) { ...@@ -225,21 +223,13 @@ function (angular, $, _, moment) {
}; };
p.getRelativeTime = function(date) { p.getRelativeTime = function(date) {
date = moment.isMoment(date) ? date : moment(date);
date = this.checkDate(date);
return this.timezone === 'browser' ? return this.timezone === 'browser' ?
moment(date).fromNow() : moment(date).fromNow() :
moment.utc(date).fromNow(); moment.utc(date).fromNow();
}; };
p.checkDate = function(date) {
if (!moment.isMoment(date)) {
date = moment(date);
}
return date;
};
p._updateSchema = function(old) { p._updateSchema = function(old) {
var i, j, k; var i, j, k;
var oldVersion = this.schemaVersion; var oldVersion = this.schemaVersion;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment