Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13960440
D16879.id40638.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D16879.id40638.diff
View Options
diff --git a/src/parser/calendar/data/PhutilCalendarAbsoluteDateTime.php b/src/parser/calendar/data/PhutilCalendarAbsoluteDateTime.php
--- a/src/parser/calendar/data/PhutilCalendarAbsoluteDateTime.php
+++ b/src/parser/calendar/data/PhutilCalendarAbsoluteDateTime.php
@@ -225,19 +225,31 @@
}
private function getEffectiveTimezone() {
- $zone = $this->getTimezone();
- if ($zone !== null) {
- return $zone;
+ $date_timezone = $this->getTimezone();
+ $viewer_timezone = $this->getViewerTimezone();
+
+ // Because all-day events are always "floating", the effective timezone
+ // is the viewer timezone if it is available. Otherwise, we'll return a
+ // DateTime object with the correct values, but it will be incorrectly
+ // adjusted forward or backward to the viewer's zone later.
+
+ $zones = array();
+ if ($this->getIsAllDay()) {
+ $zones[] = $viewer_timezone;
+ $zones[] = $date_timezone;
+ } else {
+ $zones[] = $date_timezone;
+ $zones[] = $viewer_timezone;
}
+ $zones = array_filter($zones);
- $zone = $this->getViewerTimezone();
- if ($zone !== null) {
- return $zone;
+ if (!$zones) {
+ throw new Exception(
+ pht(
+ 'Datetime has no timezone or viewer timezone.'));
}
- throw new Exception(
- pht(
- 'Datetime has no timezone or viewer timezone.'));
+ return head($zones);
}
public function newPHPDateTimeZone() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 15 2024, 11:24 PM (4 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6714882
Default Alt Text
D16879.id40638.diff (1 KB)
Attached To
Mode
D16879: Fix an issue where All Day events could return a DateTime with the wrong timezone
Attached
Detach File
Event Timeline
Log In to Comment