From 659af5805b5ff8de56ab88b076ee60b0079edc2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Schn=C3=BCriger?= Date: Mon, 6 Mar 2017 06:37:53 +0100 Subject: [PATCH] fix(timeline): #2795 fix date for custom format function (#2826) * Fix #2795 issue --- lib/timeline/TimeStep.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/timeline/TimeStep.js b/lib/timeline/TimeStep.js index 2ea1a4fa..d0f230f6 100644 --- a/lib/timeline/TimeStep.js +++ b/lib/timeline/TimeStep.js @@ -521,6 +521,9 @@ TimeStep.prototype.getLabelMinor = function(date) { if (date == undefined) { date = this.current; } + if (date instanceof Date) { + date = this.moment(date) + } if (typeof(this.format.minorLabels) === "function") { return this.format.minorLabels(date, this.scale, this.step); @@ -540,7 +543,10 @@ TimeStep.prototype.getLabelMajor = function(date) { if (date == undefined) { date = this.current; } - + if (date instanceof Date) { + date = this.moment(date) + } + if (typeof(this.format.majorLabels) === "function") { return this.format.majorLabels(date, this.scale, this.step); }