Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Period.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public function durationLessThan(Period|Duration|DateInterval|string $duration):
public function isBefore(Period|DatePoint|DateTimeInterface|string $timeSlot): bool
{
if ($timeSlot instanceof self) {
return $this->endDate <= $timeSlot->startDate;
return $this->endDate <= $timeSlot->startDate && !$this->meetsOnStart($timeSlot);
}

$datePoint = self::filterDatePoint($timeSlot);
Expand Down
8 changes: 4 additions & 4 deletions src/PeriodRelationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ public static function isBeforeProvider(): array
'exclude start date is before interval' => [
'interval' => Period::after('2012-01-01', '1 MONTH', Bounds::ExcludeStartIncludeEnd),
'input' => Period::fromMonth(2012, 2),
'expected' => true,
'expected' => false,
],
'exclude start date is not before interval' => [
'interval' => Period::after('2012-01-01', '1 MONTH', Bounds::ExcludeStartIncludeEnd),
'input' => Period::fromMonth(2012, 2),
'input' => Period::fromMonth(2012, 3),
'expected' => true,
],
'exclude start date abuts interval start date' => [
Expand Down Expand Up @@ -155,10 +155,10 @@ public static function isAfterProvider(): array
'exclude start date is before interval' => [
'interval' => Period::fromMonth(2012, 2),
'input' => Period::after('2012-01-01', '1 MONTH', Bounds::ExcludeStartIncludeEnd),
'expected' => true,
'expected' => false,
],
'exclude start date is not before interval' => [
'interval' => Period::fromMonth(2012, 2),
'interval' => Period::fromMonth(2012, 3),
'input' => Period::after('2012-01-01', '1 MONTH', Bounds::ExcludeStartIncludeEnd),
'expected' => true,
],
Expand Down
Loading