diff --git a/src/lib/isFloat.js b/src/lib/isFloat.js index e6cced044..643f9729f 100644 --- a/src/lib/isFloat.js +++ b/src/lib/isFloat.js @@ -5,7 +5,7 @@ export default function isFloat(str, options) { assertString(str); options = options || {}; const float = new RegExp(`^(?:[-+])?(?:[0-9]+)?(?:\\${options.locale ? decimal[options.locale] : '.'}[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$`); - if (str === '' || str === '.' || str === '-' || str === '+') { + if (str === '' || str === '.' || str === ',' || str === '-' || str === '+') { return false; } const value = parseFloat(str.replace(',', '.')); diff --git a/src/lib/isPassportNumber.js b/src/lib/isPassportNumber.js index 4aaf2c291..11d01e8d1 100644 --- a/src/lib/isPassportNumber.js +++ b/src/lib/isPassportNumber.js @@ -52,7 +52,7 @@ const passportRegexByCountryCode = { MY: /^[AHK]\d{8}$/, // MALAYSIA MX: /^\d{10,11}$/, // MEXICO NL: /^[A-Z]{2}[A-Z0-9]{6}\d$/, // NETHERLANDS - NZ: /^([Ll]([Aa]|[Dd]|[Ff]|[Hh])|[Ee]([Aa]|[Pp])|[Nn])\d{6}$/, // NEW ZELAND + NZ: /^([Ll]([Aa]|[Dd]|[Ff]|[Hh])|[Ee]([Aa]|[Pp])|[Nn])\d{6}$/, // NEW ZEALAND PH: /^([A-Z](\d{6}|\d{7}[A-Z]))|([A-Z]{2}(\d{6}|\d{7}))$/, // PHILIPPINES PK: /^[A-Z]{2}\d{7}$/, // PAKISTAN PL: /^[A-Z]{2}\d{7}$/, // POLAND diff --git a/test/validators.test.js b/test/validators.test.js index 0f1404d59..86b3522b7 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -4122,6 +4122,7 @@ describe('Validators', () => { ' ', '', '.', + ',', 'foo', '20.foo', '2020-01-06T14:31:00.135Z',