-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
We cannot use 64-bit integers (limit > 2^32) as limits for numbers, and they are not considered legal integers. This comes from the fact that bitwise operators in JS are defined to work on 32-bit values, and we use a bitwise OR to validate the limit in min, max and integer
Version
This have been in number.js since the beginning.
Reproduce:
var Joi = require('joi');
try { Joi.validate(1394035612552, Joi.number().min(1394035612500));
} catch (e) { console.log(e); }
try { Joi.validate(1394035612552, Joi.number().max(1394035612600));
} catch (e) { console.log(e); }
console.log(Joi.validate(1394035612552, Joi.number().integer()));
Result:
[Error: limit must be an integer]
[Error: limit must be an integer]
{ details:
[ { message: 'the value of <root> must be an integer',
path: '<root>',
type: 'number.int' } ],
_object: 1394035612552,
message: 'the value of <root> must be an integer' }
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defect