fix: Table sorting for ID and date columns (#802)

The usage of `parseFloat` was breaking the sorting of ID and date
columns in the table.

This is because `parseFloat("000-123")` returns `0` instead of `123` or
`NaN`, and `parseFloat("2025-01-02T03:04:05.678Z")` returns `2025`.

Replacing `parseFloat` with `Number` fixes the issue, as now the values
received for Asset ID and date columns will correctly return `NaN`, and
end up being sorted as strings.
This commit is contained in:
Michael Manganiello
2025-06-22 20:45:33 -03:00
committed by GitHub
parent c53cefe6cb
commit 8493ec0c90

View File

@@ -256,8 +256,8 @@
function extractSortable(item: ItemSummary, property: keyof ItemSummary): string | number | boolean {
const value = item[property];
if (typeof value === "string") {
// Try parse float
const parsed = parseFloat(value);
// Try to parse number
const parsed = Number(value);
if (!isNaN(parsed)) {
return parsed;
}