core icon indicating copy to clipboard operation
core copied to clipboard

Add an "exact" parameter to DateFilter

Open flegars opened this issue 2 years ago • 1 comments

Description
Hi,

Does adding an "exact" setting regarding the date filter seem like something realistic? Although it is possible to obtain the same result via the available settings it could be nice to be able to filter on a very specific date

Example

#[ApiResource(
    'operations' => [
        new GetCollection()
    ]
)
#[ApiFilter(DateFilter::class, properties: ['date' => 'exact'])]
class Book
{
    private int $id;

    private \DateTime $date;
}

Using it would be done as follows:

/api/books?date[exact]=2024-01-16T13:26:00Z

flegars avatar Jan 16 '24 22:01 flegars

Sure, feel free to open a PR

soyuka avatar Mar 15 '24 10:03 soyuka