-
-
Notifications
You must be signed in to change notification settings - Fork 144
Conversation
59339ce
to
06ab12e
Compare
f95f74e
to
096f013
Compare
src/components/Input.react.js
Outdated
@@ -89,6 +92,11 @@ export default class Input extends PureComponent { | |||
); | |||
} | |||
|
|||
getValueAsNumber(value) { | |||
const numericValue = convert(value); | |||
return numericValue % 1 === 0 ? Math.floor(numericValue) : numericValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shammamah Can you explain the reasoning for this line? If n % 1 === 0
isn't it already an integer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure if it would automatically convert to int vs. remaining as a float. Fixed in 24b3b9d.
src/components/Input.react.js
Outdated
@@ -93,8 +93,7 @@ export default class Input extends PureComponent { | |||
} | |||
|
|||
getValueAsNumber(value) { | |||
const numericValue = convert(value); | |||
return numericValue % 1 === 0 ? Math.floor(numericValue) : numericValue; | |||
return convert(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point why not just call convert directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 21281de!
Co-Authored-By: Marc-André Rivet <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃
Closes #627.
About
The core of the issue was that
valueAsNumber
was always returningNaN
even if the input value was a number, which is a known issue with IE: https://caniuse.com/#feat=input-number