diff --git a/src/applications/differential/query/DifferentialRevisionQuery.php b/src/applications/differential/query/DifferentialRevisionQuery.php --- a/src/applications/differential/query/DifferentialRevisionQuery.php +++ b/src/applications/differential/query/DifferentialRevisionQuery.php @@ -25,6 +25,8 @@ private $updatedEpochMax; private $statuses; private $isOpen; + private $createdEpochMin; + private $createdEpochMax; const ORDER_MODIFIED = 'order-modified'; const ORDER_CREATED = 'order-created'; @@ -206,6 +208,12 @@ return $this; } + public function withCreatedEpochBetween($min, $max) { + $this->createdEpochMin = $min; + $this->createdEpochMax = $max; + return $this; + } + /** * Set whether or not the query should load the active diff for each @@ -687,6 +695,20 @@ $this->updatedEpochMax); } + if ($this->createdEpochMin !== null) { + $where[] = qsprintf( + $conn_r, + 'r.dateCreated >= %d', + $this->createdEpochMin); + } + + if ($this->createdEpochMax !== null) { + $where[] = qsprintf( + $conn_r, + 'r.dateCreated <= %d', + $this->createdEpochMax); + } + if ($this->statuses !== null) { $where[] = qsprintf( $conn_r, diff --git a/src/applications/differential/query/DifferentialRevisionSearchEngine.php b/src/applications/differential/query/DifferentialRevisionSearchEngine.php --- a/src/applications/differential/query/DifferentialRevisionSearchEngine.php +++ b/src/applications/differential/query/DifferentialRevisionSearchEngine.php @@ -45,6 +45,12 @@ $query->withStatuses($map['statuses']); } + if ($map['createdStart'] || $map['createdEnd']) { + $query->withCreatedEpochBetween( + $map['createdStart'], + $map['createdEnd']); + } + return $query; } @@ -84,6 +90,16 @@ ->setDatasource(new DifferentialRevisionStatusFunctionDatasource()) ->setDescription( pht('Find revisions with particular statuses.')), + id(new PhabricatorSearchDateField()) + ->setLabel(pht('Created After')) + ->setKey('createdStart') + ->setDescription( + pht('Find revisions created at or after a particular time.')), + id(new PhabricatorSearchDateField()) + ->setLabel(pht('Created Before')) + ->setKey('createdEnd') + ->setDescription( + pht('Find revisions created at or before a particular time.')), ); }