mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
typesafe format for numbers
This commit is contained in:
@@ -640,6 +640,7 @@ const Devices: FC = () => {
|
|||||||
{me.admin && (
|
{me.admin && (
|
||||||
<IconButton onClick={customize}>
|
<IconButton onClick={customize}>
|
||||||
<FormatListNumberedIcon
|
<FormatListNumberedIcon
|
||||||
|
color="primary"
|
||||||
sx={{ fontSize: 18, verticalAlign: 'middle' }}
|
sx={{ fontSize: 18, verticalAlign: 'middle' }}
|
||||||
/>
|
/>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export function formatValue(
|
|||||||
uom: DeviceValueUOM
|
uom: DeviceValueUOM
|
||||||
) {
|
) {
|
||||||
if (typeof value !== 'number') {
|
if (typeof value !== 'number') {
|
||||||
return value;
|
return (value === undefined ? '' : value) as string;
|
||||||
}
|
}
|
||||||
switch (uom) {
|
switch (uom) {
|
||||||
case DeviceValueUOM.HOURS:
|
case DeviceValueUOM.HOURS:
|
||||||
|
|||||||
Reference in New Issue
Block a user