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

Use parser options in getPixelForValue for time scale #3131

Merged
merged 1 commit into from
Aug 22, 2016
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
2 changes: 1 addition & 1 deletion src/scales/scale.time.js
Expand Up @@ -338,7 +338,7 @@ module.exports = function(Chart) {
var me = this;
if (!value || !value.isValid) {
// not already a moment object
value = moment(me.getRightValue(value));
value = me.parseTime(me.getRightValue(value));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...ya know, you could have just used this here... ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would work, but this cannot be minified. Since this would be used in a bunch of places, we do var me = this so that me can be minified in the function. In a single function this doesn't save much, but over the entire lib it saves a few kB.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I did my maths correctly, it currently saves 4KB (~3%) on the minified version.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...learn something new... ;)

}
var labelMoment = value && value.isValid && value.isValid() ? value : me.getLabelMoment(datasetIndex, index);

Expand Down