function get_valid_calendar_event_timestart_range(\calendar_event $event) {
        $instance = $this->get_instance();
        $submissionsfromdate = $instance->allowsubmissionsfromdate;
        $cutoffdate = $instance->cutoffdate;
        $duedate = $instance->duedate;
        $gradingduedate = $instance->gradingduedate;
        $mindate = null;
        $maxdate = null;

        if ($event->eventtype == ASSIGN_EVENT_TYPE_DUE) {
            // This check is in here because due date events are currently
            // the only events that can be overridden, so we can save a DB
            // query if we don't bother checking other events.
            if ($this->is_override_calendar_event($event)) {
                // This is an override event so there is no valid timestart
                // range to set it to.
                return [false, false];
            }

            if ($submissionsfromdate) {
                $mindate = [
                    $submissionsfromdate,
                    get_string('duedatevalidation', 'assign'),
                ];
            }

            if ($cutoffdate) {
                $maxdate = [
                    $cutoffdate,
                    get_string('cutoffdatevalidation', 'assign'),
                ];
            }

            if ($gradingduedate) {
                // If we don't have a cutoff date or we've got a grading due date
                // that is earlier than the cutoff then we should use that as the
                // upper limit for the due date.
                if (!$cutoffdate || $gradingduedate < $cutoffdate) {
                    $maxdate = [
                        $gradingduedate,
                        get_string('gradingdueduedatevalidation', 'assign'),
                    ];
                }
            }
        } else if ($event->eventtype == ASSIGN_EVENT_TYPE_GRADINGDUE) {
            if ($duedate) {
                $mindate = [
                    $duedate,
                    get_string('gradingdueduedatevalidation', 'assign'),
                ];
            } else if ($submissionsfromdate) {
                $mindate = [
                    $submissionsfromdate,
                    get_string('gradingduefromdatevalidation', 'assign'),
                ];
            }
        }

        return [$mindate, $maxdate];
    }