Skip to content

String becomes Infinity after Number() #905

@sophiedophie

Description

@sophiedophie

Hello, I found an issue here.
https://github.com/exceljs/exceljs/blob/master/lib/csv/csv.js#L71

At this line, if we get the string such as 6E10000, then datumNumber would be Infinity but still return it because !Number.isNaN(datumNumber) is true so we can't open the generated excel file.

const str = '6E10001';
console.log(Number(str)); // Inifinity

So we should add one more condition, so the condition should be

if (!Number.isNaN(datumNumber) && datumNumber !== Infinity) {
  return datumNumber;
}

If people agree with this, I want to make a PR for this. thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions