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

Widget: calendar widget event filtering only ever return events 5 days in the past. #2394

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading