Skip to content

feat(doctrine): add an input format to DateFilter - #8678

Merged
soyuka merged 3 commits into
api-platform:mainfrom
soyuka:feat/date-filter-format
Oct 16, 2026
Merged

soyuka merged 3 commits into
api-platform:mainfrom
soyuka:feat/date-filter-format

Conversation

@soyuka

@soyuka soyuka commented Oct 13, 2026

Copy link
Copy Markdown
Member
Q A
Branch? main
Tickets Closes #8047
License MIT
Doc PR api-platform/docs#... (todo)

DateFilter (ORM and ODM) gets a format argument, e.g. new DateFilter(format: 'd/m/Y'), so ?createdAt[before]=15/06/2024 is parsed with createFromFormat. The bound value stays a date, so ordering is unchanged. Unparsed fields reset to zero (no current time-of-day leaking into before/after), invalid or overflowing values (32/03/2024) are ignored like today. The schema drops format: date when a custom format is set.

Test: tests/Functional/Parameters/DateFilterTest.php::testDateFilterWithInputFormat

Parse the query value with createFromFormat when a format is set,
e.g. new DateFilter(format: 'd/m/Y'), on ORM and ODM. Unparsed
fields reset to zero and overflowing dates are ignored.

Closes api-platform#8047
@soyuka
soyuka merged commit 23c4876 into api-platform:main Oct 16, 2026
111 of 117 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Allow Date Filter to be formatted

1 participant