mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 16:35:42 +00:00
fix(freight:api): ton number conversion
This commit is contained in:
@@ -672,7 +672,13 @@ export class TrainSchedulingService {
|
|||||||
return date.toISOString().slice(0, 10);
|
return date.toISOString().slice(0, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
private roundTons(value: number) {
|
private roundTons(value: number | string | null | undefined) {
|
||||||
return Number(value.toFixed(3));
|
const numericValue = typeof value === 'number' ? value : Number(value ?? 0);
|
||||||
|
|
||||||
|
if (!Number.isFinite(numericValue)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Number(numericValue.toFixed(3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user