iloire / watchmen

A simple node.js service monitor
MIT License
941 stars 195 forks source link

scripts.js:18 Failed to parse x '1463399700000' to Date object #66

Closed jstott closed 7 years ago

jstott commented 8 years ago

After setting up a site to monitor - viewing charts results in scripts.js:18 Failed to parse x '1463399700000' to Date object

Is there lib update or any format settings for dates returned by service monitor?

brownman commented 8 years ago

+1

brownman commented 8 years ago

as a temporary solution: updating c3.js fixed it for me:

  c3_chart_internal_fn.parseDate = function (date) {
        var $$ = this, parsedDate;
        if (date instanceof Date) {
            parsedDate = date;
        } else if (typeof date === 'string') {
            parsedDate = $$.dataTimeFormat($$.config.data_xFormat).parse(date);
        } else if (typeof date === 'number' && !isNaN(date)) {
            parsedDate = new Date(+date);
        } 
//////////////////////////////////////////// added:
else if (Array.isArray(date) && date[0]) {
            parsedDate = new Date(+date[0]);
        }
///////////////////////////////////////////
        if (!parsedDate || isNaN(+parsedDate)) {
            window.console.error("Failed to parse x '" + date + "' to Date object");
        }
        return parsedDate;
    };
iloire commented 8 years ago

Please, could you enumerate the steps to reproduce this? thanks