Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BTRIA-2100/missing timezone parameter #2007

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
== Changelog ==

= [TBD] TBD =

* Fix - Correct `tribe_get_end_date` to return dates in the correct time zone. [BTRIA-2100]

= [5.1.15.2] 2023-12-04 =

* Fix - Ensure correct access rights to JSON-LD data depending on the user role. [TEC-4995]
Expand Down
26 changes: 13 additions & 13 deletions src/functions/template-tags/date.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
* Formatted Date
*
* Returns formatted date
*
*
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
* @since 5.11.1 Introduced a temporary locale switch to handle the AM/PM format specifically for French language settings.
*
* @category Events
*
* @param string $date String representing the datetime, assumed to be UTC (relevant if timezone conversion is used)
* @param bool $display_time If true shows date and time, if false only shows date
* @param string $date_format Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
* @param string $date_format Allows date and time formatting using standard php syntax (http://php.net/manual/en/function.date.php)
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
*
* @return string
*/
Expand Down Expand Up @@ -128,7 +128,7 @@ function tribe_beginning_of_day( $date = null, $format = 'Y-m-d H:i:s' ) {
* @category Events
*
* @param string $date The date to find the end of the day, defaults to today
* @param string $format Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
* @param string $format Allows date and time formatting using standard php syntax (http://php.net/manual/en/function.date.php)
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
*
* @return string
*/
Expand Down Expand Up @@ -160,7 +160,7 @@ function tribe_end_of_day( $date = null, $format = 'Y-m-d H:i:s' ) {

if ( ! function_exists( 'tribe_get_datetime_separator' ) ) {
/**
* Get the datetime saparator from the database option with escaped characters or not ;)
* Get the datetime separator from the database option with escaped characters or not ;)
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
*
* @param string $default Default Separator if it's blank on the Database
* @param bool $esc If it's going to be used on a `date` function or method it needs to be escaped
Expand Down Expand Up @@ -189,8 +189,8 @@ function tribe_get_datetime_separator( $default = ' @ ', $esc = false ) {
* @category Events
*
* @param int $event (optional)
* @param string $date_format Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
* @param string $timezone Timezone in which to present the date/time (or default behaviour if not set)
* @param string $date_format Allows date and time formatting using standard php syntax (http://php.net/manual/en/function.date.php)
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
* @param string $timezone Timezone in which to present the date/time (or default behavior if not set)
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
*
* @return string|null Time
*/
Expand Down Expand Up @@ -240,8 +240,8 @@ function tribe_get_start_time( $event = null, $date_format = '', $timezone = nul
* @category Events
*
* @param int $event (optional)
* @param string $date_format Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
* @param string $timezone Timezone in which to present the date/time (or default behaviour if not set)
* @param string $date_format Allows date and time formatting using standard php syntax (http://php.net/manual/en/function.date.php)
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
* @param string $timezone Timezone in which to present the date/time (or default behavior if not set)
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
*
* @return string|null Time
*/
Expand Down Expand Up @@ -294,8 +294,8 @@ function tribe_get_end_time( $event = null, $date_format = '', $timezone = null
*
* @param int $event (optional)
* @param bool $display_time If true shows date and time, if false only shows date
* @param string $date_format Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
* @param string $timezone Deprecated. Timezone in which to present the date/time (or default behaviour if not set)
* @param string $date_format Allows date and time formatting using standard php syntax (http://php.net/manual/en/function.date.php)
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
* @param string $timezone Deprecated. Timezone in which to present the date/time (or default behavior if not set)
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
*
* @return string|null Date
*/
Expand Down Expand Up @@ -356,8 +356,8 @@ function tribe_get_start_date( $event = null, $display_time = true, $date_format
*
* @param int $event (optional)
* @param bool $display_time If true shows date and time, if false only shows date
* @param string $date_format Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
* @param string $timezone Deprecated. Timezone in which to present the date/time (or default behaviour if not set)
* @param string $date_format Allows date and time formatting using standard php syntax (http://php.net/manual/en/function.date.php)
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
* @param string $timezone Deprecated. Timezone in which to present the date/time (or default behavior if not set)
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
*
* @return string|null Date
*/
Expand Down Expand Up @@ -387,7 +387,7 @@ function tribe_get_end_date( $event = null, $display_time = true, $date_format =

// @todo [BTRIA-584]: Move timezones to Common.
if ( class_exists( 'Tribe__Events__Timezones' ) ) {
$end_date = Tribe__Events__Timezones::event_end_timestamp( $event->ID );
$end_date = Tribe__Events__Timezones::event_end_timestamp( $event->ID, $timezone );
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
Camwyn marked this conversation as resolved.
Show resolved Hide resolved
} else {
return null;
}
Expand Down
Loading