Skip to content

Strange behaviour with date + raw #525

@satazor

Description

@satazor

I've been using the new .raw() method as follows:

Joi.date().options({ convert: true }).raw().iso()

which works correctly and the validator throws the following error on invalid input:

value must be a valid ISO 8601 date

but strangely:

Joi.date().iso().options({ convert: true }).raw()

throws the following error on invalid input:

value must be a number of milliseconds or valid date string

It seems that .options() and/or .raw() is causing the underlying flags._format to be lost.
Is this the desired behavior?

Thanks in advance.

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions