X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/428d454e2681d66bb14558946cfe2fb77a2c8dce..4b961d16b8f8ef8afbd13697a79fe4684acd0416:/src/validators/is-number.tsx diff --git a/src/validators/is-number.tsx b/src/validators/is-number.tsx index 9b548b94..b43eec95 100644 --- a/src/validators/is-number.tsx +++ b/src/validators/is-number.tsx @@ -3,8 +3,8 @@ // SPDX-License-Identifier: AGPL-3.0 import { isNumber as isNum } from 'lodash'; -const ERROR_MESSAGE = 'This field must be a number'; +const ERROR_MESSAGE = 'This field can only contain numeric values'; export const isNumber = (value: any) => { - return isNum(value) ? undefined : ERROR_MESSAGE; + return !isNaN(value) && isNum(value) ? undefined : ERROR_MESSAGE; };