Tribe__Events__Repositories__Event::filter_by_ends_on_or_before( string|DateTime|int $datetime, string|DateTimeZone $timezone = null )

Filters events whose end date occurs on or before the provided date; fetch is not inclusive.


Parameters

$datetime

(string|DateTime|int) (Required) A strtotime parse-able string, a DateTime object or a timestamp.

$timezone

(string|DateTimeZone) (Optional) A timezone string, UTC offset or DateTimeZone object; defaults to the site timezone; this parameter is ignored if the $datetime parameter is a DatTime object.

Default value: null


Top ↑

Return

(array) An array of arguments that should be added to the WP_Query object.


Top ↑

Source

File: src/Tribe/Repositories/Event.php

	public function filter_by_ends_on_or_before( $datetime, $timezone = null ) {
		$date = Tribe__Date_Utils::build_date_object( $datetime, $timezone )
		                         ->setTimezone( $this->normal_timezone );

		return array(
			'meta_query' => array(
				'ends-before' => array(
					'key'     => $this->end_meta_key,
					'compare' => '<=',
					'value'   => $date->format( Tribe__Date_Utils::DBDATETIMEFORMAT ),
					'type'    => 'DATETIME',
				),
			),
		);
	}

Top ↑

Changelog

Changelog
Version Description
4.9 Introduced.