From 3915e9c00c7b67129f292e6af63c76bf2f3bea58 Mon Sep 17 00:00:00 2001 From: jos Date: Fri, 9 Jan 2015 14:06:09 +0100 Subject: [PATCH] Made TimeAxis robust against old versions of moment.js. Updated to moment.js 2.9.0 --- HISTORY.md | 4 ++++ examples/graph2d/08_performance.html | 2 +- examples/graph2d/13_localization.html | 2 +- examples/network/34_circular_images.html | 2 +- examples/timeline/03_performance.html | 2 +- examples/timeline/05_groups.html | 2 +- examples/timeline/13_past_and_future.html | 2 +- lib/timeline/TimeStep.js | 3 ++- package.json | 2 +- 9 files changed, 13 insertions(+), 8 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index bbec78e7..ec77ea30 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -4,6 +4,10 @@ http://visjs.org ## not yet released, version 3.7.3-SNAPSHOT +### General + +- Updated to moment.js v2.9.0 + ### Network - Fixed flipping of hierarchical network on update when using RL and DU. diff --git a/examples/graph2d/08_performance.html b/examples/graph2d/08_performance.html index 9a249f6c..a1130f76 100644 --- a/examples/graph2d/08_performance.html +++ b/examples/graph2d/08_performance.html @@ -15,7 +15,7 @@ - + diff --git a/examples/graph2d/13_localization.html b/examples/graph2d/13_localization.html index f249fc6f..777f558e 100644 --- a/examples/graph2d/13_localization.html +++ b/examples/graph2d/13_localization.html @@ -13,7 +13,7 @@ } - + diff --git a/examples/network/34_circular_images.html b/examples/network/34_circular_images.html index 0201718e..1dc395b7 100644 --- a/examples/network/34_circular_images.html +++ b/examples/network/34_circular_images.html @@ -1,7 +1,7 @@ - Network | Scalable images + Network | Circular images - + diff --git a/examples/timeline/05_groups.html b/examples/timeline/05_groups.html index 7182670f..e54fd2e7 100644 --- a/examples/timeline/05_groups.html +++ b/examples/timeline/05_groups.html @@ -17,7 +17,7 @@ - + diff --git a/examples/timeline/13_past_and_future.html b/examples/timeline/13_past_and_future.html index 019dde17..6a764c4a 100644 --- a/examples/timeline/13_past_and_future.html +++ b/examples/timeline/13_past_and_future.html @@ -80,7 +80,7 @@ // set a custom range from -2 minute to +3 minutes current time var start = new Date((new Date()).getTime() - 2 * 60 * 1000); var end = new Date((new Date()).getTime() + 3 * 60 * 1000); - timeline.setWindow(start, end); + timeline.setWindow(start, end, {animate: false}); diff --git a/lib/timeline/TimeStep.js b/lib/timeline/TimeStep.js index ffe3f9de..0fc63505 100644 --- a/lib/timeline/TimeStep.js +++ b/lib/timeline/TimeStep.js @@ -527,7 +527,8 @@ TimeStep.prototype.getLabelMajor = function(date) { }; TimeStep.prototype.getClassName = function() { - var date = moment(this.current).locale('en'); + var m = moment(this.current); + var date = m.locale ? m.locale('en') : m.lang('en'); // old versions of moment have .lang() function var step = this.step; function even(value) { diff --git a/package.json b/package.json index 49df363c..34238d2e 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "dependencies": { "emitter-component": "^1.1.1", "hammerjs": "^1.1.0", - "moment": "^2.7.0", + "moment": "^2.9.0", "keycharm": "^0.2.0" }, "devDependencies": {