Skip to content

Commit

Permalink
[BUGFIX] Fix range string calculation in DateRange facet
Browse files Browse the repository at this point in the history
This change fixes the range string calculation, so items for
the given date are included until 23:59 of the target end date.

Fixes: #4087
Ports: #4090
  • Loading branch information
derhansen authored and dkd-kaehm committed Jul 4, 2024
1 parent 6e65779 commit ae4a299
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function __construct(
protected function getRangeString(): string
{
$from = $this->startRequested === null ? '' : $this->startRequested->format('Ymd') . '0000';
$till = $this->endRequested === null ? '' : $this->endRequested->format('Ymd') . '0000';
$till = $this->endRequested === null ? '' : $this->endRequested->format('Ymd') . '2359';
return $from . '-' . $till;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function facetIsCreated()
self::assertSame($facet->getConfiguration(), $facetConfiguration['myCreated.'], 'Configuration was not passed to new facets');
self::assertTrue($facet->getIsUsed());

self::assertEquals('201506020000-201706020000', $facet->getRange()->getLabel());
self::assertEquals('201506020000-201706022359', $facet->getRange()->getLabel());
self::assertEquals(32, $facet->getRange()->getDocumentCount());
self::assertCount(3, $facet->getRange()->getRangeCounts(), 'We expected that there are three count items attached');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function canHandleHalfOpenDateRanges()
$error->getMessage() . ' in ' . $error->getFile() . ':' . $error->getLine()
);
}
self::assertEquals('-202107200000', $dateRangeCollectionKeyOpenStart);
self::assertEquals('-202107202359', $dateRangeCollectionKeyOpenStart);
self::assertEquals('202107200000-', $dateRangeCollectionKeyOpenEnd);
}
}

0 comments on commit ae4a299

Please sign in to comment.