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

I find it easier to follow and checkdate didnt do much.
This commit is contained in:
carl bergquist
2015-12-16 16:32:55 +01:00
parent 8c02a7bd6b
commit 2cb83cf19d
+2 -12
View File
@@ -214,9 +214,7 @@ function (angular, $, _, moment) {
};
p.formatDate = function(date, format) {
date = this.checkDate(date);
date = moment.isMoment(date) ? date : moment(date);
format = format || 'YYYY-MM-DD HH:mm:ss';
return this.timezone === 'browser' ?
@@ -225,21 +223,13 @@ function (angular, $, _, moment) {
};
p.getRelativeTime = function(date) {
date = this.checkDate(date);
date = moment.isMoment(date) ? date : moment(date);
return this.timezone === 'browser' ?
moment(date).fromNow() :
moment.utc(date).fromNow();
};
p.checkDate = function(date) {
if (!moment.isMoment(date)) {
date = moment(date);
}
return date;
};
p._updateSchema = function(old) {
var i, j, k;
var oldVersion = this.schemaVersion;