Skip to content

Commit

Permalink
Allow negative numbers (#156)
Browse files Browse the repository at this point in the history
* Allow negative numbers

* Adjusts the regex to just remove e characters

Co-authored-by: Christopher Patty <christopher.patty@aggiemail.usu.edu>
  • Loading branch information
kennarddh and Christopher Patty committed Apr 16, 2022
1 parent 1e8070d commit 4429236
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const TextInput = ({
}
}}
onChange={e => {
const inputValue = e.target.value.replace(/[^0-9.]+/g, '');
const inputValue = e.target.value.replace(/e/g, "");
if (!!inputValue) {
const value = parseFloat(inputValue, 10);
if (Number.isNaN(value)) {
Expand Down

0 comments on commit 4429236

Please sign in to comment.