3

Using Chart.js (v.2.3.0) and Moment.js (v.2.9.0), I am rendering a Chart.js bubble chart in a lightning component and I am setting a custom tooltip and the x-axis labels to formatted dates.

sample configuration:

 
...    
tooltips: {
  enabled: true,
  callbacks: {
    title: function(tooltipItems, data) { 
      var dataIndex = tooltipItems[0].index;
      var datasetIndex = tooltipItems[0].datasetIndex;
      return moment(data.datasets[datasetIndex].data[dataIndex].x).format('MMM Do, YYYY');
  },
...

Up until Spring 17 - Patch 5.5 this seemed to work as expected:

expected

As of Spring 17 - Patch 6.0, the function is rendered instead of its' executed result:

unexpected

Is this a platform (Spring 17) bug? Has anyone else experienced anything similar with moment.js date formatting?

2
  • @DougChasman Please look at this post.
    – crmprogdev
    Jan 25, 2017 at 13:36
  • 1
    Yes there is a known issue with the changes required to finally enable CSP unsafe-eval/inlines that revealed a use of instanceof on Function in Moment.js - the use if instanceof has always been in the short list of things not supported under LS (cross realm issue) but we've recently figured out how to actually support instanceof. This has been fixed in Summer'17 and is planned for backporting to Spring'17 as soon as we've finish testing/verifying on the next major release. Jan 25, 2017 at 14:22

1 Answer 1

0

The fix for this instanceof specific issue has been released to all instances running Spring'17 and moment.js etc should be functioning correctly now.

2
  • The issue above has been resolved on Spring 17 instances in Lightning Experience, but I am still noticing regressions when using the same lightning component on a VF page with lightningOut (apex:includeLightning). As far as I can tell the regression occurred in the last two weeks. I can not identify the root of the issue, could the recent platform fixes around instanceof support be in any way affecting lightningOut cases? Feb 22, 2017 at 17:07
  • I highly doubt the fix for instanceof is the culprit here - can you provide more info. What regressions? Perhaps a fresh new post would be best if its not a continued issue with "Script not being executed but rendered instead - Lightning - Spring 17 - Patch 6.0" - to help keep things separated. Thanks Feb 22, 2017 at 22:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .