He usado la validación YUP. Necesito agregar la validación de fecha de inicio y fecha de finalización del padre en hitos.
export const validationSchema = Yup.object().shape( { name: requiredString, startDate: Yup.date() .nullable() .when('endDate', { is: (val) => val, then: Yup.date().nullable().max(Yup.ref('endDate'), 'message'), }), endDate: Yup.date() .nullable() .when('startDate', { is: (val) => val, then: Yup.date().nullable().min(Yup.ref('startDate'), 'message'), }), milestones: Yup.array().of( Yup.object().shape( { name: requiredString, startDate: Yup.date() .nullable() .when('endDate', { is: (val) => val, then: Yup.date().nullable().max(Yup.ref('endDate'), 'message'), }), endDate: Yup.date() .nullable() .when('startDate', { is: (val) => val, then: Yup.date().nullable().min(Yup.ref('startDate'), 'message'), }), }, [['startDate', 'endDate']] ) ), }, [['startDate', 'endDate']] );