I have a sonata date range filter
protected function configureDatagridFilters(DatagridMapper $filter)
{
$now = new \DateTime();
$filter
->add('created_at', 'doctrine_orm_date_range', array(
'label' => 'created_at_long',
'input_type' => 'text',
'field_options' => array(
'widget' => 'single_text'
)
)
);
}
If I enter the same date, elements with this date are not returned in my list. Is there a way to tell sonata do not use strict comparaison and use "less than or equal" and "greater than or equal" operators ?
I think adding a format tag will relax the constraints. Works for (is inclusive) me anyway with the following:
'format' => 'dd/MM/yyyy'
From this currently live/working filter:
->add('someField', 'doctrine_orm_date_range', [], null, ['format' => 'dd/MM/yyyy', 'widget' => 'single_text'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With