From fa261501e4cb62e413a46b58c50af33ac36735b1 Mon Sep 17 00:00:00 2001 From: Philipp Kinschel Date: Mon, 12 Oct 2015 11:37:24 -0600 Subject: [PATCH 1/2] fix: Timestamps not converted to Date anymore #238 Signed-off-by: Philipp Kinschel --- lib/shared-method.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/shared-method.js b/lib/shared-method.js index 5b469e64..74391257 100644 --- a/lib/shared-method.js +++ b/lib/shared-method.js @@ -398,8 +398,15 @@ function convertValueToTargetType(argName, value, targetType) { switch (targetType) { case 'string': return String(value).valueOf(); - case 'date': + case 'date': { + + // could be a timestamp as string + if (!isNaN(value) && typeof value == 'string') { + value = Number(value).valueOf(); + } + return new Date(value); + } case 'number': return Number(value).valueOf(); case 'boolean': From ba32cb35d7dad0159fe0cf062519b9c5c34ff66c Mon Sep 17 00:00:00 2001 From: Philipp Kinschel Date: Tue, 13 Oct 2015 10:24:09 -0600 Subject: [PATCH 2/2] fix: code style error Signed-off-by: Philipp Kinschel --- lib/shared-method.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/shared-method.js b/lib/shared-method.js index 74391257..6536d30c 100644 --- a/lib/shared-method.js +++ b/lib/shared-method.js @@ -403,7 +403,7 @@ function convertValueToTargetType(argName, value, targetType) { // could be a timestamp as string if (!isNaN(value) && typeof value == 'string') { value = Number(value).valueOf(); - } + } return new Date(value); }