API v2.1.x
Compatibility
This version requires joi v17 or newer.
Rules
date.format(format)
Specifies the allowed date format:
format
- string or array of strings that follow themoment.js
format.
const schema = Joi.date().format(['YYYY/MM/DD', 'DD-MM-YYYY']);
const schema = Joi.date().format('YYYY-MM-DD HH:mm');
date.utc()
Dates will be parsed as UTC instead of using the machine's local timezone.
const schema = Joi.date().utc().format(['YYYY/MM/DD', 'DD-MM-YYYY']);