Skip to content

Commit

Permalink
[Finder] Fix using == as default operator in DateComparator
Browse files Browse the repository at this point in the history
  • Loading branch information
MatTheCat committed Dec 29, 2024
1 parent daea9ec commit 1d0e826
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Comparator/DateComparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(string $test)
throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
}

$operator = $matches[1] ?? '==';
$operator = $matches[1] ?: '==';
if ('since' === $operator || 'after' === $operator) {
$operator = '>';
}
Expand Down
1 change: 1 addition & 0 deletions Tests/Comparator/DateComparatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static function getTestData()
['after 2005-10-10', [strtotime('2005-10-15')], [strtotime('2005-10-09')]],
['since 2005-10-10', [strtotime('2005-10-15')], [strtotime('2005-10-09')]],
['!= 2005-10-10', [strtotime('2005-10-11')], [strtotime('2005-10-10')]],
['2005-10-10', [strtotime('2005-10-10')], [strtotime('2005-10-11')]],
];
}
}

0 comments on commit 1d0e826

Please sign in to comment.