Pending Review
Last Updated: 30 Nov 2018 11:47 by ADMIN
Paul
Created on: 22 Nov 2018 04:49
Category: Spreadsheet
Type: Bug Report
0
Bug in js\spreadsheet\numformat.js makeDateFormat

Bug in js\spreadsheet\numformat.js makeDateFormat

 

You appear to be using the wrong indices inside a nested loop.

if (/^(?:date|time|ampm)$/.test(section.body[i].type)) {

Should be (switch i to j)

if (/^(?:date|time|ampm)$/.test(section.body[j].type)) {

Getting error

Uncaught TypeError: Cannot read property 'type' of undefined
     at Object.<anonymous> (numformat.js:630)

 

Note: Version is actually 2018.3.1114 from npm

3 comments
ADMIN
Misho
Posted on: 30 Nov 2018 11:47
Hello Paul,

Thank you for providing us with the additional information. We've confirmed this is a bug and already fixed the loop indices. For your reference, the fix in the code looks similar to what you've suggested:

for (var i = 0; i < tree.length; ++i) {
            section = tree[i];
            for (var j = 0; j < section.body.length; ++j) {
                if (/^(?:date|time|ampm)$/.test(section.body[j].type)) {
                    found = true;
                    if (section.body[j].type == "ampm") {
                        hasAmpm = true;
                    }

You could expect to get the fix in the next internal release.

As a small token of gratitude for your report I'm adding 500 points to your account.

Thanks for your contribution.

Best Regards,
Misho
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Paul
Posted on: 29 Nov 2018 01:30

Hi Misho, 

Thanks for getting back to me. It'll take quite a bit of work on our side to produce a stripped down sample of this. Instead here is the patch that we've applied to continue using the spreadsheets. As you can see by simply looking at the loops, any time the tree length is greater than the section body length there will be an error as the section body index is incorrect.

patch-package
--- a/node_modules/@progress/kendo-ui/js/spreadsheet/numformat.js
+++ b/node_modules/@progress/kendo-ui/js/spreadsheet/numformat.js
@@ -627,7 +627,7 @@ module.exports =
        for (var i = 0; i < tree.length; ++i) {
            section = tree[i];
            for (var j = 0; j < section.body.length; ++j) {
-                 if (/^(?:date|time|ampm)$/.test(section.body[i].type)) {
+                 if (/^(?:date|time|ampm)$/.test(section.body[j].type)) {
                    found = true;
                    if (section.body[i].type == "ampm") {
                        hasAmpm = true;

 

 

      
ADMIN
Misho
Posted on: 28 Nov 2018 11:28
Hello Paul,

Thank you for contacting us about the problem you are experiencing with Kendo Spreadsheet. Could you please provide a dojo sample showing your setup and Spreadsheet data as well as the steps to reproduce the problem?

Thank you for your collaboration.

Best Regards,
Misho
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.