Question: I'm trying to filter a list of articles by publish date using Lexik Form Filter bundle.

My entity:

```
class Article {
    [...]

    /**
      * @ORM\Column(name="publish_date", type="datetime", nullable=true)
      */
    protected $publishDate;

    [...]
}

```

My form type:

```
class ArticleFilterType extends AbstractType{

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('publishDate', 'filter_date');
        [...]
    }

    public function getName()
{
    return 'article_filter';
}

public function setDefaultOptions(OptionsResolverInterface $resolver)
{
    $resolver->setDefaults(array(
        'data_class'        => 'Orm\CrawlerBundle\Entity\Article',
        'csrf_protection'   => false,
        'validation_groups' => array('filter'),
    ));

}

```

When I filter filling the form with a publish date of one of my articles I've no result. What is the problem? The type I'm using for the date in db is datetime.

Thanks!

Answer: 
I guess you should use the filter\_datetime or filter\_datetime\_range from Lexik : 

```
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('publishDate', 'filter_datetime');
        [...]
    }

```
Controller:

```
class ArticleController extends Controller {

/**
 * Lists all Article entities.
 *
 * @Route("/article_admin", name="article_admin")
 * @Template()
 */
public function listArticleAction() {
    /** @var ArticleBiz $em */
    $em = $this->get('orm_crawler.articlebiz');
    $form = $this->createForm(new ArticleFilterType());

    // initialize a query builder
    /** @var QueryBuilder $filterBuilder */
    $filterBuilder = $em->getRepository()->createQueryBuilder('e');
    if ($this->get('request')->query->has($form->getName())) {
        // manually bind values from the request
        $form->submit($this->get('request')->query->get($form->getName()));
        // build the query from the given form object
        $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($form, $filterBuilder);
    }

    $paginator = $this->get('knp_paginator')->paginate($filterBuilder->getQuery(), $this->getRequest()->query->get('page', 1), 10);

    return array(
        'form' => $form->createView(),
        'paginator' => $paginator
    );
}

```