format numbers
Reviewed By: lblasa Differential Revision: D50653525 fbshipit-source-id: 265a2821acef572ca6d9576be647ee1d07f3850e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8af6ca7f02
commit
20a1b9d255
@@ -326,6 +326,11 @@ function StyledInput({
|
||||
mutable: boolean;
|
||||
rightAddon?: string;
|
||||
}) {
|
||||
let formatted: any = value;
|
||||
if (typeof value === 'number') {
|
||||
//cap the number of decimal places to 5 but dont add trailing zeros
|
||||
formatted = Number.parseFloat(value.toFixed(5));
|
||||
}
|
||||
return (
|
||||
<Input
|
||||
size="small"
|
||||
@@ -347,7 +352,7 @@ function StyledInput({
|
||||
)}
|
||||
bordered
|
||||
readOnly={!mutable}
|
||||
value={value}
|
||||
value={formatted}
|
||||
suffix={rightAddon}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user