Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14016309
D12728.id30586.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12728.id30586.diff
View Options
diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
--- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
+++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
@@ -52,35 +52,35 @@
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
$query = id(new PhabricatorCalendarEventQuery());
$viewer = $this->requireViewer();
+ $timezone = new DateTimeZone($viewer->getTimezoneIdentifier());
$min_range = $this->getDateFrom($saved)->getEpoch();
$max_range = $this->getDateTo($saved)->getEpoch();
- if ($saved->getParameter('display') == 'month') {
- list($start_year, $start_month) =
+ if ($saved->getParameter('display') == 'month' ||
+ $saved->getParameter('display') == 'day') {
+ list($start_year, $start_month, $start_day) =
$this->getDisplayYearAndMonthAndDay($saved);
- $start_day = 1;
- $end_year = ($start_month == 12) ? $start_year + 1 : $start_year;
- $end_month = ($start_month == 12) ? 1 : $start_month + 1;
- $end_day = 1;
+ $start_day = new DateTime(
+ "{$start_year}-{$start_month}-{$start_day}",
+ $timezone);
+ $next = clone $start_day;
- $calendar_start = AphrontFormDateControlValue::newFromParts(
- $viewer,
- $start_year,
- $start_month,
- $start_day)->getEpoch();
- $calendar_end = AphrontFormDateControlValue::newFromParts(
- $viewer,
- $end_year,
- $end_month,
- $end_day)->getEpoch();
+ if ($saved->getParameter('display') == 'month') {
+ $next->modify('+1 month');
+ } else if ($saved->getParameter('display') == 'day') {
+ $next->modify('+1 day');
+ }
+
+ $display_start = $start_day->format('U');
+ $display_end = $next->format('U');
- if (!$min_range || ($min_range < $calendar_start)) {
- $min_range = $calendar_start;
+ if (!$min_range || ($min_range < $display_start)) {
+ $min_range = $display_start;
}
- if (!$max_range || ($max_range > $calendar_end)) {
- $max_range = $calendar_end;
+ if (!$max_range || ($max_range > $display_end)) {
+ $max_range = $display_end;
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 5, 7:48 AM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6726606
Default Alt Text
D12728.id30586.diff (2 KB)
Attached To
Mode
D12728: Restricting query to return the displayed range
Attached
Detach File
Event Timeline
Log In to Comment