From 2bdd4afd23e548c07b9096a6decd569c256afa0b Mon Sep 17 00:00:00 2001 From: proddy Date: Thu, 10 Oct 2024 21:21:35 +0100 Subject: [PATCH] support for unknown value and uom --- interface/src/app/main/deviceValue.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/interface/src/app/main/deviceValue.ts b/interface/src/app/main/deviceValue.ts index f7a71d7ff..132717800 100644 --- a/interface/src/app/main/deviceValue.ts +++ b/interface/src/app/main/deviceValue.ts @@ -27,12 +27,16 @@ const formatDurationMin = (LL: TranslationFunctions, duration_min: number) => { export function formatValue( LL: TranslationFunctions, - value: unknown, - uom: DeviceValueUOM + value?: unknown, + uom?: DeviceValueUOM ) { - if (typeof value !== 'number') { - return (value === undefined ? '' : value) as string; + if (typeof value !== 'number' || uom === undefined || value === undefined) { + if (value === undefined || typeof value === 'boolean') { + return ''; + } + return value as string; } + switch (uom) { case DeviceValueUOM.HOURS: return value ? formatDurationMin(LL, value * 60) : LL.NUM_HOURS({ num: 0 });