From: Jukka Kurkela Date: Sun, 18 Apr 2021 11:30:54 +0000 (+0300) Subject: Time: cache options needed by parse (#8933) X-Git-Tag: v3.2.0~8 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=e1404ac83410a7fb5a9e4cb77620c8d3c205d0b9;p=thirdparty%2FChart.js.git Time: cache options needed by parse (#8933) --- diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index c528a3890..18da79aa4 100644 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -48,8 +48,7 @@ function parse(scale, input) { } const adapter = scale._adapter; - const options = scale.options.time; - const {parser, round, isoWeekday} = options; + const {parser, round, isoWeekday} = scale._parseOpts; let value = input; if (typeof parser === 'function') { @@ -217,6 +216,7 @@ export default class TimeScale extends Scale { this._majorUnit = undefined; this._offsets = {}; this._normalized = false; + this._parseOpts = undefined; } init(scaleOpts, opts) { @@ -229,6 +229,12 @@ export default class TimeScale extends Scale { // missing formats on update mergeIf(time.displayFormats, adapter.formats()); + this._parseOpts = { + parser: time.parser, + round: time.round, + isoWeekday: time.isoWeekday + }; + super.init(scaleOpts); this._normalized = opts.normalized;