Skip to content

Commit

Permalink
Avoid parsing percentage string (#4496)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-pollard authored Apr 27, 2023
1 parent 074e553 commit f524151
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export const useDataTableExport = (columns, data, title, startDate, endDate) =>
? tableData.map(row =>
tableColumns.map(col => {
const value = row.values[col.id];
const num = parseFloat(value);
const valueIsPercentageString = value.includes('%');
const num = valueIsPercentageString ? value : parseFloat(value);
// if it's a number, return in number format
return isNaN(num) ? value : num;
}),
Expand Down

0 comments on commit f524151

Please sign in to comment.