Tribe__Events__Repositories__Event::filter_by_timezone( string|DateTimeZone $timezone )
Filters events the given timezone.
Contents
UTC, UTC+0, and UTC-0 should be parsed as the same timezone.
Parameters
- $timezone
-
(string|DateTimeZone) (Required) A timezone string or object.
Return
(array) An array of arguments to apply to the query.
Source
File: src/Tribe/Repositories/Event.php
public function filter_by_timezone( $timezone ) { if ( $timezone instanceof DateTimeZone ) { $timezone = $timezone->getName(); } $is_utc = preg_match( '/^UTC((\\+|-)0)*$/i', $timezone ); if ( $is_utc ) { return array( 'meta_query' => array( 'by-timezone' => array( 'key' => '_EventTimezone', 'compare' => 'IN', 'value' => array( 'UTC', 'UTC+0', 'UTC-0' ), ), ), ); } return array( 'meta_query' => array( 'by-timezone' => array( 'key' => '_EventTimezone', 'value' => $timezone, ), ), ); }
Changelog
Version | Description |
---|---|
4.9 | Introduced. |