Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time: cache options needed by parse #8933

Merged
merged 1 commit into from Apr 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/scales/scale.time.js
Expand Up @@ -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') {
Expand Down Expand Up @@ -217,6 +216,7 @@ export default class TimeScale extends Scale {
this._majorUnit = undefined;
this._offsets = {};
this._normalized = false;
this._parseOpts = undefined;
}

init(scaleOpts, opts) {
Expand All @@ -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;
Expand Down