Based on this question I'm trying to configure a filter date, but the default format is for example "May 13, 2016 1:12 PM 13, 2016, 1:12:50 pm"
. In my DB I store datetimes in this format "aaaa-mm-dd hh:mm:ss"
.
So, when I apply the filter above, none result is returned.
My code:
//Admin Class.php
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('firstName')
->add('lastName')
->add('createdAt', 'doctrine_orm_datetime_range', array(
'field_type' => 'sonata_type_datetime_range_picker',
'show_filter' => true
))
;
}
#config.yml
sonata_admin:
templates:
layout: AppBundle::standard_layout.html.twig
Trying something like this, but does not work.
{# standard_layout.html.twig #}
{% extends 'SonataAdminBundle::standard_layout.html.twig' %}
{% block javascripts %}
{{ parent() }}
jQuery(document).ready(function(){
//jQuery.datepicker.setDefaults( jQuery.datepicker.regional[ "" ] );
$('#dtp_filter_createdAt_value_start').datetimepicker({
dateFormat: "yy-mm-dd"
});
});
{% endblock %}