fix min and max props

This commit is contained in:
casperlamboo 2018-01-17 16:10:22 +01:00
parent 11222aaa82
commit 53e961b9bb

View File

@ -58,8 +58,8 @@ const _NumberField = ({ name, min, max, muiTheme, ...props }, context) => (
value={_.get(context, name.toString())}
onChange={(event, value) => {
value = parseFloat(value);
if (min) value = Math.max(value, min);
if (max) value = Math.min(value, max);
if (typeof min === 'number') value = Math.max(value, min);
if (typeof max === 'number') value = Math.min(value, max);
context.onChange(name, value);
}}
/>