Skip to content

Commit

Permalink
fixes #199 - change value formats degrees to strings
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Nov 17, 2021
1 parent 5f6033c commit 8b40c92
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions interface/src/project/ValueForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '@material-ui/core';

import { FormButton } from '../components';
import { DeviceValue, DeviceValueUOM, DeviceValueUOM_s } from './EMSESPtypes';
import { DeviceValue, DeviceValueUOM_s } from './EMSESPtypes';

interface ValueFormProps {
devicevalue: DeviceValue;
Expand All @@ -25,17 +25,6 @@ interface ValueFormProps {
data: keyof DeviceValue
) => (event: React.ChangeEvent<HTMLInputElement>) => void;
}

function formatValue(value: any, uom: number) {
if (uom === DeviceValueUOM.DEGREES) {
return new Intl.NumberFormat(undefined, {
minimumFractionDigits: 1
}).format(value);
}

return value;
}

class ValueForm extends React.Component<ValueFormProps> {
formRef: RefObject<any> = React.createRef();

Expand Down Expand Up @@ -79,7 +68,7 @@ class ValueForm extends React.Component<ValueFormProps> {
{!devicevalue.l && (
<OutlinedInput
id="value"
value={formatValue(devicevalue.v, devicevalue.u)}
value={devicevalue.v}
autoFocus
fullWidth
onChange={handleValueChange('v')}
Expand Down

0 comments on commit 8b40c92

Please sign in to comment.