Start by ensuring that the end date/time conditional is disabled if there is no start date/time selected.
Next, upon selecting a start date/time, validate to ensure that the end date/time is not before the start date/time, displaying an error message if necessary.
Additionally, consider disabling days prior to the selected start date/time in the end date/time field (consult your date/time picker library documentation for guidance).
You have the option to utilize yup for validating date and time inputs, or you can implement manual validation like so:
If your date/time values are in epoch format, use the following schema as an example:
const schema = yup.object({
fromDate: yup.number().required(),
toDate: yup.number().moreThan(yup.ref("fromDate")).required(),
});
I trust this information will be beneficial to you.