Skip to content

[BUG] Deprecation Warning - from moment.js when using time axesΒ #23

@tiholic

Description

@tiholic

Expected Behavior

Current Behavior

Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.
Arguments: 
[0] _isAMomentObject: true, _isUTC: false, _useUTC: false, _l: undefined, _i: 2018.01.01, _f: undefined, _strict: undefined, _locale: [object Object]
Error
    at Function.createFromInputFallback (http://127.0.0.1:8000/static/documerge/node_modules/moment/moment.js?v=1523389320944:320:98)
    at configFromString (http://127.0.0.1:8000/static/documerge/node_modules/moment/moment.js?v=1523389320944:2368:15)
    at configFromInput (http://127.0.0.1:8000/static/documerge/node_modules/moment/moment.js?v=1523389320944:2594:13)
    at prepareConfig (http://127.0.0.1:8000/static/documerge/node_modules/moment/moment.js?v=1523389320944:2577:13)
    at createFromConfig (http://127.0.0.1:8000/static/documerge/node_modules/moment/moment.js?v=1523389320944:2544:44)
    at createLocalOrUTC (http://127.0.0.1:8000/static/documerge/node_modules/moment/moment.js?v=1523389320944:2631:16)
    at createLocal (http://127.0.0.1:8000/static/documerge/node_modules/moment/moment.js?v=1523389320944:2635:16)
    at hooks (http://127.0.0.1:8000/static/documerge/node_modules/moment/moment.js?v=1523389320944:12:29)
    at momentify (http://127.0.0.1:8000/static/documerge/node_modules/chart.js/dist/Chart.js?v=1523389320944:13795:11)
    at parse (http://127.0.0.1:8000/static/documerge/node_modules/chart.js/dist/Chart.js?v=1523389320944:13817:14)
warn @ moment.js?v=1523389320944:293
(anonymous) @ moment.js?v=1523389320944:320
configFromString @ moment.js?v=1523389320944:2368
configFromInput @ moment.js?v=1523389320944:2594
prepareConfig @ moment.js?v=1523389320944:2577
createFromConfig @ moment.js?v=1523389320944:2544
createLocalOrUTC @ moment.js?v=1523389320944:2631
createLocal @ moment.js?v=1523389320944:2635
hooks @ moment.js?v=1523389320944:12
momentify @ Chart.js?v=1523389320944:13795
parse @ Chart.js?v=1523389320944:13817
determineDataLimits @ Chart.js?v=1523389320944:14149
update @ Chart.js?v=1523389320944:7230
update @ Chart.js?v=1523389320944:14109
getMinimumBoxSize @ Chart.js?v=1523389320944:6416
each @ Chart.js?v=1523389320944:9899
update @ Chart.js?v=1523389320944:6430
updateLayout @ Chart.js?v=1523389320944:4259
update @ Chart.js?v=1523389320944:4214
construct @ Chart.js?v=1523389320944:3944
Chart @ Chart.js?v=1523389320944:6215

image

Possible Solution

Moment.js might deprecate the functionality. Unless provided date format along with date. like moment(value, format) in #13795 form the above screenshot

Steps to Reproduce (for bugs)

  1. Configure to time axis
{
type: "line",
data: {
            // labels: ["Used", "Remaining"],
            datasets: [{
                label: 'Test Merges',
                xAxisID: "time",
                fill: true,
                lineTension: 0,
                data: [
                    {x: '01-01-2018', y:10},
                    {x: '02-01-2018', y:5},
                    {x: '02-05-2018', y:15}
                ]
            }]
        },
config: {
            scales: {
               xAxes: [{
                    id: 'time',
                    type: 'time',
                    time: {
                        tooltipFormat: "DD MMMM, YYYY"
                    }
                }]
            }
        };
    }
}

Environment

  • Chart.js version: "^2.7.2",
  • Chrome 65.0.3325.181

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions