Skip to content

Commit

Permalink
Merge pull request #16 from GeoSot/GeoSot-patch-1
Browse files Browse the repository at this point in the history
fix: class is initialized outside each event scope, and in case of two events in the same time-frame we get duplicated classes
  • Loading branch information
benhall14 authored Sep 23, 2024
2 parents 52edb61 + d0e1708 commit c47ff22
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/phpCalendar/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -992,11 +992,7 @@ public function asWeekView($date = false, $color = false)

$datetime = $date->setTime(substr($time, 0, 2), substr($time, 3, 2));

$events = $this->findEvents($datetime, 'week');

$class = '';

$event_summary = '';
$events = $this->findEvents($datetime, 'week');

$today_class = ($date->format('Y-m-d H') == $today->format('Y-m-d H')) ? ' today' : '';

Expand All @@ -1006,6 +1002,11 @@ public function asWeekView($date = false, $color = false)

if ($events) {
foreach ($events as $index => $event) {

$class = '';

$event_summary = '';

if (in_array($event, $used_events)) {
$event_summary = ' ';
} else {
Expand Down

0 comments on commit c47ff22

Please sign in to comment.