Open tiholic opened 6 years ago
@simonbrunel @benmccann thoughts on how to handle this? One solution might be to try and if moment errors out, throw something else.
I think a try ... catch
here would be an important performance hit since it's called very often (I already removed exception handling for color parsing). What moment recommend as alternative for this deprecation?
As mentioned in the Issue description, format needs to be passed long with value. As they are not supposed to assume a date format for the value being passed, as per the RFC2822 or ISO format.
///So,
moment(value); //moment("04-12-2018");
//must be changed to
moment(value, format); //moment("04-12-2018", "MM-DD-YYYY");
That's line 13791 and if Chart.js users didn't provide a format, then we still need to fallback to moment(value)
so we can't just drop support for moment(value)
until next major release.
maybe we can just assume ISO8601 .... it makes the deprecation warning go away but it doesn't necessarily solve the problem
I moved this from the main repo, now that the moment adapter code is split out and optional
I think it would be best to document this and suggest providing the format
or parser
option to the time scale.
Or we could add a lot of dead weight by doing some checks on first data point etc, with try/catch and specific errors.
Specifying the format
or parser
option is the best way to go here IMO
Expected Behavior
Current Behavior
Possible Solution
Moment.js might deprecate the functionality. Unless provided date format along with date. like
moment(value, format)
in #13795 form the above screenshotSteps to Reproduce (for bugs)
Environment