From 24ffacb3e782e6cbbacc2b89383b6448b5c2f925 Mon Sep 17 00:00:00 2001 From: Alexander Wunschik Date: Sat, 29 Oct 2016 20:47:34 +0200 Subject: [PATCH] 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 +};