Basierend auf this Frage Ich versuche, ein Filterdatum zu konfigurieren, aber das Standardformat ist zum Beispiel "May 13, 2016 1:12 PM 13, 2016, 1:12:50 pm"
. In meiner DB speichere ich Datumswerte in diesem Format "aaaa-mm-dd hh:mm:ss"
. Also, wenn ich den obigen Filter anwende, wird kein Ergebnis zurückgegeben.SonataAdminBundle: DateTime Picker-Format
Mein 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
Der Versuch, so etwas wie dieses, aber nicht funktioniert.
{# 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 %}