Page MenuHomePhabricator

D13008.id.diff
No OneTemporary

D13008.id.diff

diff --git a/src/infrastructure/time/PhabricatorTime.php b/src/infrastructure/time/PhabricatorTime.php
--- a/src/infrastructure/time/PhabricatorTime.php
+++ b/src/infrastructure/time/PhabricatorTime.php
@@ -72,4 +72,10 @@
return $today;
}
+ public static function getDateTimeFromEpoch($epoch, PhabricatorUser $viewer) {
+ $datetime = new DateTime('@'.$epoch);
+ $datetime->setTimeZone($viewer->getTimeZone());
+ return $datetime;
+ }
+
}
diff --git a/src/view/phui/calendar/PHUICalendarDayView.php b/src/view/phui/calendar/PHUICalendarDayView.php
--- a/src/view/phui/calendar/PHUICalendarDayView.php
+++ b/src/view/phui/calendar/PHUICalendarDayView.php
@@ -103,8 +103,16 @@
$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;

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 27, 6:57 AM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6735868
Default Alt Text
D13008.id.diff (1 KB)

Event Timeline