我想将里程碑的startDate引用到Milestone的startDatePlanned,以确保startDatePlanned大于项目的startDate。
但是我收到错误references "ref:Project.startDate" which is not a date
我的代码如下
const Project = {
id: Joi.number().optional(),
name: Joi.string().required(),
startDate: Joi.date().required()
}
const Phases = Joi.object().keys({
id: Joi.number().optional(),
name: Joi.string().required(),
milestones: Joi.array().items(Milestone).unique()
});
const Milestone = Joi.object().keys({
id: Joi.number().optional(),
name: Joi.string().required(),
projectPhaseId: Joi.number().optional(),
startDatePlanned: Joi.date().required().greater(Joi.ref('Project.startDate')).optional(),
endDatePlanned: Joi.date().required().greater(Joi.ref('startDatePlanned')).optional(),
startDateActual: Joi.date().optional().greater(Joi.ref('startDatePlanned')).optional(),
});