-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing codebugBug or defectBug or defectfeatureNew functionality or improvementNew functionality or improvement
Milestone
Description
Context
- node version: all
- joi version: 10.5.0
- environment (node, browser): node
- used with (hapi, standalone, ...): standalone
- any other relevant information:
What are you trying to achieve or the steps to reproduce ?
Due to a limitation with using joi as the schema for DynamoDb via https://github.com/ryanfitz/vogels I need to validate dates with joi.string().isoDate() and use the value returned from validation to store in DynamoDb. I need the date to be formatted in the simplified extended ISO format in the same way that joi.date().iso() would return.
const stringSchema = Joi.string().isoDate();
const dateSchema = Joi.date().iso();
const stringResults = Joi.validate('2017-01-01', stringSchema);
const dateResults = Joi.validate('2017-01-01', dateSchema);
// want these to be the same
console.log('string value: ', stringResults.result);
console.log('date value: ', dateResults.result);Which result you had ?
The string schema just returns the provided string. i.e "2017-01-01" returns "2017-01-01"
What did you expect ?
I want it to return "2017-01-01T00:00:00.000Z", or an option to convert it as such
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing codebugBug or defectBug or defectfeatureNew functionality or improvementNew functionality or improvement