Skip to content

Commit

Permalink
[bug] Fix off-by-1 error in IntegerSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
bartkusa committed Mar 27, 2016
1 parent 615d276 commit bbd9739
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/ex3/components/IntegerSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export default createClass({


function renderOptions({min, max, value}) {
let optionValues = rangeRight(Math.min(min, value), Math.max(value, max));
let optionValues = rangeRight(Math.min(min, value), Math.max(value, max) + 1);
// rangeRight excludes the maximum, so you need the +1 to get it in the array
if (optionValues.length === 0) optionValues = [value];

return optionValues.map((i) => (
Expand Down

0 comments on commit bbd9739

Please sign in to comment.