Skip to content

Commit

Permalink
NightInterval::containsValue() fix
Browse files Browse the repository at this point in the history
  • Loading branch information
VladaHejda authored and paranoiq committed Jun 22, 2023
1 parent a3e6315 commit 5ed8a35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Time/Interval/NightInterval.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ public function compareIntersects(IntersectComparable $other): int
*/
public function containsValue($date): bool
{
if ($this->isEmpty()) {
return false;
}

if (!$date instanceof Date) {
$date = Date::createFromDateTimeInterface($date);
}
Expand Down
1 change: 1 addition & 0 deletions tests/src/Time/Interval/NightInterval.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ Assert::false($interval->containsValue($d(21)));
Assert::false($interval->containsValue($d(5)));
Assert::false($interval->containsValue($d(25)));
Assert::true($interval->containsValue(new DateTimeImmutable('2000-01-15')));
Assert::false($empty->containsValue($d(10)));


contains:
Expand Down

0 comments on commit 5ed8a35

Please sign in to comment.