1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-30 08:28:20 +01:00

Multi-day events should be correctly calculated for new js layout

Summary: Fixes T8304, Multi-day events should be correctly calculated for new js layout

Test Plan: A day with events starting before midnight of the displayed day should be correctly placed and fitted for day view.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T8304

Differential Revision: https://secure.phabricator.com/D13008
This commit is contained in:
lkassianik 2015-05-25 11:19:57 -07:00
parent ea131bb2ef
commit e4c9914697
2 changed files with 16 additions and 2 deletions

View file

@ -72,4 +72,10 @@ final class PhabricatorTime {
return $today;
}
public static function getDateTimeFromEpoch($epoch, PhabricatorUser $viewer) {
$datetime = new DateTime('@'.$epoch);
$datetime->setTimeZone($viewer->getTimeZone());
return $datetime;
}
}

View file

@ -103,8 +103,16 @@ final class PHUICalendarDayView extends AphrontView {
$event->getEpochEnd() > $day_start_epoch) {
if ($first_event_hour === null) {
$first_event_hour = new DateTime('@'.$event->getEpochStart());
$first_event_hour->setTimeZone($viewer->getTimeZone());
$first_event_hour = PhabricatorTime::getDateTimeFromEpoch(
$event->getEpochStart(),
$viewer);
$midnight = $this->getDateTime()->setTime(0, 0, 0);
if ($first_event_hour->format('U') < $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;