Skip to content

Commit

Permalink
TMS-1031: Fix event-component recurring manual-event dates
Browse files Browse the repository at this point in the history
  • Loading branch information
eebbi committed Apr 10, 2024
1 parent 3f4e47a commit 055e977
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- TMS-1031: Fix event-component recurring manual-event dates

## [1.54.7] - 2024-03-26

- TMS-914:
Expand Down
12 changes: 6 additions & 6 deletions lib/Formatters/EventzFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,14 +399,14 @@ protected function get_recurring_manual_events( array $category_ids = null ) : a

// Loop through events
$recurring_events = array_map( function ( $e ) {
$id = $e->ID;
$event = (object) \get_fields( $id );
$id = $e->ID;
$event = (object) \get_fields( $id );
$time_now = \current_datetime();
$timezone = new \DateTimeZone( 'Europe/Helsinki' );

foreach ( $event->dates as $date ) {
date_default_timezone_set( 'Europe/Helsinki' );
$time_now = \current_datetime()->getTimestamp();
$event_start = strtotime( $date['start'] );
$event_end = strtotime( $date['end'] );
$event_start = new \DateTime( $date['start'], $timezone );
$event_end = new \DateTime( $date['end'], $timezone );

// Return only ongoing or next upcoming event
if ( ( $time_now > $event_start && $time_now < $event_end ) || $time_now < $event_start ) {
Expand Down

0 comments on commit 055e977

Please sign in to comment.