public static function singleEventDate()
    {
        global $post;

        $singleOccasion = array();
        $get_date = (!empty(get_query_var('date'))) ? get_query_var('date') : false;
        $occasions = QueryEvents::getEventOccasions($post->ID);

        //Get nearest occasions from time if no date arg
        if (!$get_date) {
            $get_date = self::getNextOccasionDate($occasions);
        }

        if (is_array($occasions) && count($occasions) == 1) {
            $singleOccasion = (array)$occasions[0];
            $singleOccasion['formatted'] = \EventManagerIntegration\App::formatEventDate($singleOccasion['start_date'], $singleOccasion['end_date']);
            $singleOccasion['date_parts'] = self::dateParts($singleOccasion['start_date']);
        } elseif (is_array($occasions) && $get_date != false) {
            foreach ($occasions as $occasion) {
                $occasion = (array)$occasion;
                $event_date = preg_replace('/\D/', '', $occasion['start_date']);
                if ($get_date == $event_date) {
                    $singleOccasion = $occasion;
                    $singleOccasion['formatted'] = \EventManagerIntegration\App::formatEventDate($occasion['start_date'], $occasion['end_date']);
                    $singleOccasion['date_parts'] = self::dateParts($occasion['start_date']);
                }
            }
        }

        return $singleOccasion;
    }
public static function singleEventDate()
    {
        global $post;

        $singleOccasion = array();
        $get_date = (!empty(get_query_var('date'))) ? get_query_var('date') : false;
        $occasions = QueryEvents::getEventOccasions($post->ID);

        //Get nearest occasions from time if no date arg
        if (!$get_date) {
            $get_date = self::getNextOccasionDate($occasions);
        }

        if (is_array($occasions) && count($occasions) == 1) {
            $singleOccasion = (array)$occasions[0];
            $singleOccasion['formatted'] = \EventManagerIntegration\App::formatEventDate($singleOccasion['start_date'], $singleOccasion['end_date']);
            $singleOccasion['date_parts'] = self::dateParts($singleOccasion['start_date']);
        } elseif (is_array($occasions) && $get_date != false) {
            foreach ($occasions as $occasion) {
                $occasion = (array)$occasion;
                $event_date = preg_replace('/\D/', '', $occasion['start_date']);
                if ($get_date == $event_date) {
                    $singleOccasion = $occasion;
                    $singleOccasion['formatted'] = \EventManagerIntegration\App::formatEventDate($occasion['start_date'], $occasion['end_date']);
                    $singleOccasion['date_parts'] = self::dateParts($occasion['start_date']);
                }
            }
        }

        return $singleOccasion;
    }
public static function singleEventDate ( ) { global $ post ; $ singleOccasion = array ( ) ; $ get_date = ( ! empty ( get_query_var ( 'date' ) ) ) ? get_query_var ( 'date' ) : false ; $ occasions = QueryEvents :: getEventOccasions ( $ post -> ID ) ; //Get nearest occasions from time if no date arg if ( ! $ get_date ) { $ get_date = self :: getNextOccasionDate ( $ occasions ) ; } if ( is_array ( $ occasions ) && count ( $ occasions ) == 1 ) { $ singleOccasion = ( array ) $ occasions [ 0 ] ; $ singleOccasion [ 'formatted' ] = \ EventManagerIntegration \ App :: formatEventDate ( $ singleOccasion [ 'start_date' ] , $ singleOccasion [ 'end_date' ] ) ; $ singleOccasion [ 'date_parts' ] = self :: dateParts ( $ singleOccasion [ 'start_date' ] ) ; } elseif ( is_array ( $ occasions ) && $ get_date != false ) { foreach ( $ occasions as $ occasion ) { $ occasion = ( array ) $ occasion ; $ event_date = preg_replace ( '/\D/' , '' , $ occasion [ 'start_date' ] ) ; if ( $ get_date == $ event_date ) { $ singleOccasion = $ occasion ; $ singleOccasion [ 'formatted' ] = \ EventManagerIntegration \ App :: formatEventDate ( $ occasion [ 'start_date' ] , $ occasion [ 'end_date' ] ) ; $ singleOccasion [ 'date_parts' ] = self :: dateParts ( $ occasion [ 'start_date' ] ) ; } } } return $ singleOccasion ; }
Get single event date
@return array
Get single event date