mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +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);
|
||||
}
|
||||
|
||||
private roundTons(value: number) {
|
||||
return Number(value.toFixed(3));
|
||||
private roundTons(value: number | string | null | undefined) {
|
||||
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