Incompatibility with datejs; mis-use of Date.parse
See first: https://github.com/abritinthebay/datejs/pull/261
Suffice to say, I'm working on a large legacy application, which makes use of datejs's Date.parse
extensions.
When rendering a Vis.js Timeline, rendering RangeItems makes use of utils.convert
to coerce the start/end of the range to a number. However, when re-rendering, this coercion is repeated, passing an integer into utils.convert again.
When this happens, it passes a number to Date.parse
, which is not officially supported by the ES5 spec. While the native version of this method in IE/FF/Chrome seems to handle this case, it's not something that should be relied upon, and accordingly using datejs's overloaded version of Date.parse causes errors, as it expects a string input.
in utils.convert
if (!isNaN(Date.parse(object))) {
return moment(object).valueOf();
} else {
return Number(object.valueOf());
}
I originally assumed that the issue was with datejs, but as its author pointed out, Vis is misusing Date.parse
.
I'm going to work on a fix that causes the minimum damage, but I'd love to hear from you guys in terms of suggestions.