update chicken weight to have chicken_area data as well

This commit is contained in:
Alberto-Audrix committed 2026-10-07 15:48:22 +07:00
1 parent a6d4ddac65
commit 6bad900cf0
13 files changed
+132 -21

No files matched your search

+9 -5
View File
@@ -1,17 +1,21 @@
export function formatNumber(
value: number,
value: number | string | null | undefined,
maxDecimals = 2,
minDecimals = 0,
truncate = false
): string {
let display = value;
const num = typeof value === 'number' ? value : Number(value);
if (!Number.isFinite(num)) return '-';
const safeMax = Math.max(0, maxDecimals);
const safeMin = Math.min(Math.max(0, minDecimals), safeMax);
let display = num;
if (truncate) {
const factor = 10 ** maxDecimals;
const factor = 10 ** safeMax;
display = Math.trunc(display * factor) / factor;
}
return display.toLocaleString('id-ID', {
maximumFractionDigits: maxDecimals,
minimumFractionDigits: minDecimals,
maximumFractionDigits: safeMax,
minimumFractionDigits: safeMin,
});
}