function validateEmailSentAt(data) {
    let emailSentAt;
    if (data.emailSentAt instanceof Date) {
        emailSentAt = data.emailSentAt;
    } else if (data.emailSentAt) {
        emailSentAt = new Date(data.emailSentAt);
        if (isNaN(emailSentAt.valueOf())) {
            throw new ValidationError({
                message: 'Invalid Date'
            });
        }
    } else {
        emailSentAt = null;
    }

    return emailSentAt;
}
@param {object} data
@param {Date|null} data.emailSentAt

@returns {Date|null}