How to setup format of datetime picker in easyadminbundle?

Anton Smatanik picture Anton Smatanik · Mar 27, 2017 · Viewed 7.6k times · Source

How can I change the default format used by the datetime picker of easyadminbundle?

I understand I must change something in config.yml in type_options of field property. Or setup some different datetime format. But how or where?

enter image description here

Answer

Maulik Savaliya picture Maulik Savaliya · Mar 27, 2017
easy_admin:
  design:
    assets:
        js: ['assets/js/jquery.datetimepicker.full.js(Your Date picker Js)', 'assets/js/initDatePicker.js (Your code to initialize date picker on base of class "datepicker")']
        css: ['assets/css/jquery.datetimepicker.css(Path of your datepicker css)']
  form:
     title: 'Your Title'
     fields:
        - { property: 'displayFrom', label: 'Display From', type_options: {'widget': 'single_text', 'format': 'dd/MM/yyyy H:mm', 'attr': {'class': 'datepicker'}} }

Just replace path of javascript and css and init datepicker, Also replace the field (displayFrom) with your form field.