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?
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.
In yml you can use datepicker class like this.
form:
title: 'Create User'
fields:
- { other fileds ...}
- { property: 'expiredAt', label: 'Credentials expired at', type_options: {'widget': 'single_text', 'format': 'dd/MM/yyyy H:mm', 'attr': {'class': 'datepicker'}} }
replace expiredAt with your field name. Hope this may helpful to you or anyone else.
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