Fixed number precision in locations page spool card

This commit is contained in:
Donkie
2024-11-25 19:07:24 +01:00
parent c57141254c
commit 04920e463a
2 changed files with 4 additions and 2 deletions

View File

@@ -97,7 +97,8 @@ export function formatWeight(weightInGrams: number, precision: number = 2): stri
const kilograms = (weightInGrams / 1000).toFixed(precision).replace(/\.?0+$/, ""); // Remove trailing zeros
return `${kilograms} kg`;
} else {
return `${weightInGrams} g`;
const grams = weightInGrams.toFixed(precision).replace(/\.?0+$/, ""); // Remove trailing zeros
return `${grams} g`;
}
}