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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ See [keep a changelog] for information about writing changes to this log.

## [Unreleased]

## [1.1.1] - 2025-03-28

- Fix date range filter error for updated field

## [1.1.0] - 2025-03-20

### Added
Expand Down
10 changes: 5 additions & 5 deletions src/Api/Dto/DailyOccurrence.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@
#[ApiFilter(
DateRangeFilter::class,
properties: [
'start' => 'start',
'end' => 'end',
'updated' => 'start',
'start' => 'gte',
'end' => 'lte',
'updated' => 'gte',
],
// Arguments only exist to provide backward compatibility with filters originally defined by the DateFilter
arguments: [
'config' => [
'start' => [
'gte' => [
'limit' => DateLimit::gte,
'throwOnInvalid' => true,
],
'end' => [
'lte' => [
'limit' => DateLimit::lte,
'throwOnInvalid' => true,
],
Expand Down
10 changes: 5 additions & 5 deletions src/Api/Dto/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@
#[ApiFilter(
DateRangeFilter::class,
properties: [
'occurrences.start' => 'start',
'occurrences.end' => 'end',
'updated' => 'start',
'occurrences.start' => 'gte',
'occurrences.end' => 'lte',
'updated' => 'gte',
],
// Arguments only exist to provide backward compatibility with filters originally defined by the DateFilter
arguments: [
'config' => [
'start' => [
'gte' => [
'limit' => DateLimit::gte,
'throwOnInvalid' => true,
],
'end' => [
'lte' => [
'limit' => DateLimit::lte,
'throwOnInvalid' => true,
],
Expand Down
10 changes: 5 additions & 5 deletions src/Api/Dto/Occurrence.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@
#[ApiFilter(
DateRangeFilter::class,
properties: [
'start' => 'start',
'end' => 'end',
'updated' => 'start',
'start' => 'gte',
'end' => 'lte',
'updated' => 'gte',
],
// Arguments only exist to provide backward compatibility with filters originally defined by the DateFilter
arguments: [
'config' => [
'start' => [
'gte' => [
'limit' => DateLimit::gte,
'throwOnInvalid' => true,
],
'end' => [
'lte' => [
'limit' => DateLimit::lte,
'throwOnInvalid' => true,
],
Expand Down
6 changes: 5 additions & 1 deletion src/Api/Filter/ElasticSearch/DateRangeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ public function getDescription(string $resourceClass): array

private function getElasticSearchQueryRanges($property, $filter): array
{
if (null === $this->properties) {
throw new \InvalidArgumentException('The property must be defined in the filter.');
}
if (!\is_array($filter)) {
$operator = $this->config[$property]->limit;
$fallbackOperator = $this->properties[$property];
$operator = $this->config[$fallbackOperator]->limit;
$value = $filter;
} else {
$operator = DateLimit::{array_key_first($filter)};
Expand Down
Loading