luci-base: validation.js: fix integer and float type validation

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2020-01-31 17:26:39 +01:00
parent 7bc338c011
commit 187bef9f6c

View file

@ -221,7 +221,7 @@ var ValidatorFactory = L.Class.extend({
types: {
integer: function() {
return this.assert(this.factory.parseInteger(this.value) !== NaN, _('valid integer value'));
return this.assert(!isNaN(this.factory.parseInteger(this.value)), _('valid integer value'));
},
uinteger: function() {
@ -229,7 +229,7 @@ var ValidatorFactory = L.Class.extend({
},
float: function() {
return this.assert(this.factory.parseDecimal(this.value) !== NaN, _('valid decimal value'));
return this.assert(!isNaN(this.factory.parseDecimal(this.value)), _('valid decimal value'));
},
ufloat: function() {