Skip to content

Commit

Permalink
Widget: calendar widget event filtering only ever return events 5 day…
Browse files Browse the repository at this point in the history
…s in the past. (#2394)

fixes xibosignage/xibo#3350
  • Loading branch information
dasgarner committed Feb 28, 2024
1 parent af51e7e commit c6113ae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/Widget/IcsProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (C) 2023 Xibo Signage Ltd
* Copyright (C) 2024 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
Expand Down Expand Up @@ -58,7 +58,6 @@ public function fetchData(DataProviderInterface $dataProvider): WidgetProviderIn
$iCalConfig = [
'replaceWindowsTimeZoneIds' => ($dataProvider->getProperty('replaceWindowsTimeZoneIds', 0) == 1),
'defaultSpan' => 1,
'filterDaysBefore' => 5
];

// What event range are we interested in?
Expand Down Expand Up @@ -99,8 +98,10 @@ public function fetchData(DataProviderInterface $dataProvider): WidgetProviderIn
$this->getLog()->debug('fetchData: final range, start=' . $rangeStart->toAtomString()
. ', end=' . $rangeEnd->toAtomString());

// Get the difference between now and the end range.
$iCalConfig['filterDaysAfter'] = $startOfDay->diffInDays($rangeEnd) + 2;
// Set up fuzzy filtering supported by the ICal library. This is included for performance.
// https://github.com/u01jmg3/ics-parser?tab=readme-ov-file#variables
$iCalConfig['filterDaysBefore'] = $rangeStart->diffInDays(Carbon::now(), false) + 2;
$iCalConfig['filterDaysAfter'] = $rangeEnd->diffInDays(Carbon::now()) + 2;

$this->getLog()->debug('Range start: ' . $rangeStart->toDateTimeString()
. ', range end: ' . $rangeEnd->toDateTimeString()
Expand Down

0 comments on commit c6113ae

Please sign in to comment.