1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

Multi-day non-all-day events should be displayed on middle day day views

Summary: Fixes T8192, Multi-day non-all-day events should be displayed on middle day day views

Test Plan: Create non-all-day event May 20 12pm - May23 12pm, open May 21 day view. Event should span the entire day.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8192

Differential Revision: https://secure.phabricator.com/D12835
This commit is contained in:
lkassianik 2015-05-13 19:57:34 -07:00
parent a76d3a8bb5
commit f233672feb

View file

@ -55,14 +55,14 @@ final class PHUICalendarDayView extends AphrontView {
$day_start = $this->getDateTime(); $day_start = $this->getDateTime();
$day_end = id(clone $day_start)->modify('+1 day'); $day_end = id(clone $day_start)->modify('+1 day');
$day_start = $day_start->format('U'); $day_start_epoch = $day_start->format('U');
$day_end = $day_end->format('U') - 1; $day_end_epoch = $day_end->format('U') - 1;
foreach ($all_day_events as $all_day_event) { foreach ($all_day_events as $all_day_event) {
$all_day_start = $all_day_event->getEpochStart(); $all_day_start = $all_day_event->getEpochStart();
$all_day_end = $all_day_event->getEpochEnd(); $all_day_end = $all_day_event->getEpochEnd();
if ($all_day_start < $day_end && $all_day_end > $day_start) { if ($all_day_start < $day_end_epoch && $all_day_end > $day_start_epoch) {
$today_all_day_events[] = $all_day_event; $today_all_day_events[] = $all_day_event;
} }
} }
@ -76,15 +76,19 @@ final class PHUICalendarDayView extends AphrontView {
if ($event->getIsAllDay()) { if ($event->getIsAllDay()) {
continue; continue;
} }
if ($event->getEpochStart() >= $hour_start if (($hour == $day_start &&
&& $event->getEpochStart() < $hour_end) { $event->getEpochStart() <= $hour_start &&
$event->getEpochEnd() > $day_start_epoch) ||
($event->getEpochStart() >= $hour_start
&& $event->getEpochStart() < $hour_end)) {
$current_hour_events[] = $event; $current_hour_events[] = $event;
$this->todayEvents[] = $event; $this->todayEvents[] = $event;
} }
} }
foreach ($current_hour_events as $event) { foreach ($current_hour_events as $event) {
$event_start = $event->getEpochStart(); $day_start_epoch = $this->getDateTime()->format('U');
$event_end = min($event->getEpochEnd(), $day_end); $event_start = max($event->getEpochStart(), $day_start_epoch);
$event_end = min($event->getEpochEnd(), $day_end_epoch);
$top = (($event_start - $hour_start) / ($hour_end - $hour_start)) $top = (($event_start - $hour_start) / ($hour_end - $hour_start))
* 100; * 100;