-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Description
Context
- node version: v12.10.0
- joi version: v16.1.4
- environment (node, browser): node
What are you trying to achieve or the steps to reproduce ?
I'm trying to validate that a date string follows a format, but it throws no error when I use it with Joi.assert for numbers that are strings.
const Joi = require('@hapi/joi')
.extend(require('@hapi/joi-date'));
const schema = Joi.date().format('YYYY-MM-DD');
Joi.assert('1', schema)
Joi.assert('10', schema)
Joi.assert('1000', schema)https://runkit.com/ljle/joi-joi-date-potential-bug-with-number-strings
If I run it with something like 100x or 1-1, it does throw the error.
Which result you had ?
undefinedWhat did you expect ?
A ValidationError thrown
exports.ValidationError: "value" must be in YYYY-MM-DD formatReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defect