From 24ffacb3e782e6cbbacc2b89383b6448b5c2f925 Mon Sep 17 00:00:00 2001 From: Alexander Wunschik Date: Sat, 29 Oct 2016 20:47:34 +0200 Subject: [PATCH 1/3] fixed conversion from date-String to Number --- lib/util.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/util.js b/lib/util.js index f9506a6a..55673cbd 100644 --- a/lib/util.js +++ b/lib/util.js @@ -392,8 +392,11 @@ exports.convert = function (object, type) { case 'number': case 'Number': - return Number(object.valueOf()); - + if (!isNaN(Date.parse(object))) { + return moment(object).valueOf(); + } else { + return Number(object.valueOf()); + } case 'string': case 'String': return String(object); @@ -1477,4 +1480,4 @@ exports.getScrollBarWidth = function () { document.body.removeChild (outer); return (w1 - w2); -}; \ No newline at end of file +}; From e39dc89cf8df3f40bfbe69fe98faf865c505fd76 Mon Sep 17 00:00:00 2001 From: Alexander Wunschik Date: Sat, 29 Oct 2016 20:48:12 +0200 Subject: [PATCH 2/3] improved timelines dataSerialization example --- .../dataHandling/dataSerialization.html | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/examples/timeline/dataHandling/dataSerialization.html b/examples/timeline/dataHandling/dataSerialization.html index 291f9ad0..79b6aebf 100644 --- a/examples/timeline/dataHandling/dataSerialization.html +++ b/examples/timeline/dataHandling/dataSerialization.html @@ -35,12 +35,12 @@ @@ -89,9 +89,10 @@ function saveData() { // get the data from the DataSet + // // Note that we specify the output type of the fields start and end - // as ISODate, which is safely serializable. Other serializable types - // are Number (unix timestamp) or ASPDate. + // as "ISODate", which is safely serializable. Other serializable types + // are "Number" (unix timestamp), "ASPDate" or "String" (without timezone!). // // Alternatively, it is possible to configure the DataSet to convert // the output automatically to ISODates like: @@ -118,4 +119,4 @@ loadData(); - \ No newline at end of file + From daf3e65622fd718ed5f221e18d1c8d7bd4aac56b Mon Sep 17 00:00:00 2001 From: Alexander Wunschik Date: Sat, 29 Oct 2016 21:55:35 +0200 Subject: [PATCH 3/3] fixed conversion from moment to ISODate --- lib/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util.js b/lib/util.js index 55673cbd..9ced5862 100644 --- a/lib/util.js +++ b/lib/util.js @@ -470,7 +470,7 @@ exports.convert = function (object, type) { return new Date(Number(match[1])).toISOString(); // parse number } else { - return new Date(object).toISOString(); // parse string + return moment(object).format(); // ISO 8601 } } else {