From 39ec742d425058eb80909c410f3ab8570d7dc47b Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Sun, 2 Jun 2013 18:42:25 +0100 Subject: [PATCH] [view/flot][xs]: cast dates to strings before attempting to parse. --- src/view.flot.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/view.flot.js b/src/view.flot.js index 5059156e..43d997a7 100644 --- a/src/view.flot.js +++ b/src/view.flot.js @@ -316,7 +316,8 @@ my.Flot = Backbone.View.extend({ var x = doc.getFieldValue(xfield); if (isDateTime) { - var _date = moment(x); + // cast to string as Date(1990) produces 1970 date but Date('1990') produces 1/1/1990 + var _date = moment(String(x)); if (_date.isValid()) { x = _date.toDate().getTime(); }