protected function get_timestamp_max_limit(\DateTimeInterface $starttime, $max) {
        // We're doing a similar calculation here as we are for the minimum
        // day timestamp. See the explanation above.
        $values = [];
        $timestamp = $max[0];
        $errorstring = $max[1];
        $maxdate = (new \DateTimeImmutable())->setTimestamp($timestamp);
        $maxstart = $maxdate->setTime(
            $starttime->format('H'),
            $starttime->format('i'),
            $starttime->format('s')
        );
        $midnight = usergetmidnight($timestamp);

        if ($maxdate >= $maxstart) {
            $values['maxdaytimestamp'] = $midnight;
        } else {
            $yesterday = (new \DateTime())->setTimestamp($midnight)->modify('-1 day');
            $values['maxdaytimestamp'] = $yesterday->getTimestamp();
        }

        // Get the human readable error message to display if the max day
        // timestamp is violated.
        $values['maxdayerror'] = $errorstring;
        return $values;
    }
protected function get_timestamp_max_limit(\DateTimeInterface $starttime, $max) {
        // We're doing a similar calculation here as we are for the minimum
        // day timestamp. See the explanation above.
        $values = [];
        $timestamp = $max[0];
        $errorstring = $max[1];
        $maxdate = (new \DateTimeImmutable())->setTimestamp($timestamp);
        $maxstart = $maxdate->setTime(
            $starttime->format('H'),
            $starttime->format('i'),
            $starttime->format('s')
        );
        $midnight = usergetmidnight($timestamp);

        if ($maxdate >= $maxstart) {
            $values['maxdaytimestamp'] = $midnight;
        } else {
            $yesterday = (new \DateTime())->setTimestamp($midnight)->modify('-1 day');
            $values['maxdaytimestamp'] = $yesterday->getTimestamp();
        }

        // Get the human readable error message to display if the max day
        // timestamp is violated.
        $values['maxdayerror'] = $errorstring;
        return $values;
    }
protected function get_timestamp_max_limit ( \ DateTimeInterface $ starttime , $ max ) { // We're doing a similar calculation here as we are for the minimum // day timestamp. See the explanation above. $ values = [ ] ; $ timestamp = $ max [ 0 ] ; $ errorstring = $ max [ 1 ] ; $ maxdate = ( new \ DateTimeImmutable ( ) ) -> setTimestamp ( $ timestamp ) ; $ maxstart = $ maxdate -> setTime ( $ starttime -> format ( 'H' ) , $ starttime -> format ( 'i' ) , $ starttime -> format ( 's' ) ) ; $ midnight = usergetmidnight ( $ timestamp ) ; if ( $ maxdate >= $ maxstart ) { $ values [ 'maxdaytimestamp' ] = $ midnight ; } else { $ yesterday = ( new \ DateTime ( ) ) -> setTimestamp ( $ midnight ) -> modify ( '-1 day' ) ; $ values [ 'maxdaytimestamp' ] = $ yesterday -> getTimestamp ( ) ; } // Get the human readable error message to display if the max day // timestamp is violated. $ values [ 'maxdayerror' ] = $ errorstring ; return $ values ; }
Get the correct maximum midnight day limit based on the event start time
and the maximum timestamp limit of what the event belongs to.

@param DateTimeInterface $starttime The event start time
@param array $max The module's maximum limit for the event
@return array Returns an array with maxdaytimestamp and maxdayerror keys.
Get the correct maximum midnight day limit based on the event start time and the maximum timestamp limit of what the event belongs to .