protected function get_timestamp_min_limit(\DateTimeInterface $starttime, $min) {
        // We need to check that the minimum valid time is earlier in the
        // day than the current event time so that if the user drags and drops
        // the event to this day (which changes the date but not the time) it
        // will result in a valid time start for the event.
        //
        // For example:
        // An event that starts on 2017-01-10 08:00 with a minimum cutoff
        // of 2017-01-05 09:00 means that 2017-01-05 is not a valid start day
        // for the drag and drop because it would result in the event start time
        // being set to 2017-01-05 08:00, which is invalid. Instead the minimum
        // valid start day would be 2017-01-06.
        $values = [];
        $timestamp = $min[0];
        $errorstring = $min[1];
        $mindate = (new \DateTimeImmutable())->setTimestamp($timestamp);
        $minstart = $mindate->setTime(
            $starttime->format('H'),
            $starttime->format('i'),
            $starttime->format('s')
        );
        $midnight = usergetmidnight($timestamp);

        if ($mindate <= $minstart) {
            $values['mindaytimestamp'] = $midnight;
        } else {
            $tomorrow = (new \DateTime())->setTimestamp($midnight)->modify('+1 day');
            $values['mindaytimestamp'] = $tomorrow->getTimestamp();
        }

        // Get the human readable error message to display if the min day
        // timestamp is violated.
        $values['mindayerror'] = $errorstring;
        return $values;
    }