mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Fix day view start hour
Summary: Ref T8308, Fix day view start hour Test Plan: Day views start at 8am OR hour of first event start time if there is an event scheduled before 8am on that day OR midnight if there is a non-all-day multi-day event carried over from the previous day Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8308 Differential Revision: https://secure.phabricator.com/D13013
This commit is contained in:
parent
6e5e6a1a8c
commit
04bf04d783
1 changed files with 9 additions and 12 deletions
|
@ -91,6 +91,7 @@ final class PHUICalendarDayView extends AphrontView {
|
|||
|
||||
$this->events = msort($this->events, 'getEpochStart');
|
||||
$first_event_hour = $this->getDateTime()->setTime(8, 0, 0);
|
||||
$midnight = $this->getDateTime()->setTime(0, 0, 0);
|
||||
|
||||
foreach ($this->events as $event) {
|
||||
if ($event->getIsAllDay()) {
|
||||
|
@ -99,21 +100,17 @@ final class PHUICalendarDayView extends AphrontView {
|
|||
if ($event->getEpochStart() <= $day_end_epoch &&
|
||||
$event->getEpochEnd() > $day_start_epoch) {
|
||||
|
||||
if ($first_event_hour === null) {
|
||||
$first_event_hour = PhabricatorTime::getDateTimeFromEpoch(
|
||||
$event->getEpochStart(),
|
||||
$viewer);
|
||||
|
||||
$midnight = $this->getDateTime()->setTime(0, 0, 0);
|
||||
|
||||
if ($first_event_hour->format('U') < $midnight->format('U')) {
|
||||
if ($event->getEpochStart() < $midnight->format('U') &&
|
||||
$event->getEpochEnd() > $midnight->format('U')) {
|
||||
$first_event_hour = clone $midnight;
|
||||
}
|
||||
|
||||
$eight_am = $this->getDateTime()->setTime(8, 0, 0);
|
||||
if ($eight_am->format('U') < $first_event_hour->format('U')) {
|
||||
$first_event_hour = clone $eight_am;
|
||||
}
|
||||
if ($event->getEpochStart() < $first_event_hour->format('U') &&
|
||||
$event->getEpochStart() > $midnight->format('U')) {
|
||||
$first_event_hour = PhabricatorTime::getDateTimeFromEpoch(
|
||||
$event->getEpochStart(),
|
||||
$viewer);
|
||||
$first_event_hour->setTime($first_event_hour->format('h'), 0, 0);
|
||||
}
|
||||
|
||||
$event_start = max($event->getEpochStart(), $day_start_epoch);
|
||||
|
|
Loading…
Reference in a new issue