Skip to content

number min/max/greater/less do not allow decimal values #609

@Justin-Kuehn

Description

@Justin-Kuehn

This:

var Joi = require('joi');
Joi.number().min(0.1).required()

Throws:

Error: limit must be an integer
    at Object.exports.assert (.\node_modules\joi\node_modules\hoek\lib\index.js:678:11)
    at internals.Number.greater (.\node_modules\joi\lib\number.js:83:10)
    at Object.<anonymous> (.\test.js:6:27)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)
    at Function.Module.runMain (module.js:490:10)
    at startup (node.js:124:16)
    at node.js:807:3

The same happens with max, greater, and less.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug or defect

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions