Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behaviour with date + raw #525

Closed
satazor opened this issue Jan 2, 2015 · 2 comments
Closed

Strange behaviour with date + raw #525

satazor opened this issue Jan 2, 2015 · 2 comments
Assignees
Labels
bug Bug or defect
Milestone

Comments

@satazor
Copy link

satazor commented Jan 2, 2015

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.

@Marsup
Copy link
Collaborator

Marsup commented Jan 2, 2015

Thanks, just in time for 5.1.0.

@Marsup Marsup added the bug Bug or defect label Jan 2, 2015
@Marsup Marsup self-assigned this Jan 2, 2015
@Marsup Marsup added this to the 5.1.0 milestone Jan 2, 2015
@Marsup Marsup closed this as completed in eff7bd3 Jan 2, 2015
@satazor
Copy link
Author

satazor commented Jan 2, 2015

Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

2 participants