Is there simple way to change the ActiveAdmin date filter display format from the default ISO format (yyyy-mm-dd)?
Instead of overwriting the js you can provide extra options to the datepicker like this:
= f.input :my_date, as: :datepicker, datepicker_options: { dateFormat: "mm/dd/yy" }
The way i fixed is is like this:
$ ->
# reset format
$('.datepicker:not(.hasDatepicker)').each ->
if $(@).val().length > 0
p = $(@).val().split('-')
$(@).val("#{p[2]}-#{p[1]}-#{p[0]}")
# change format
$(document).on 'focus', '.datepicker:not(.hasDatepicker)', ->
$(@).datepicker dateFormat: 'dd-mm-yy'
So first reset the value from yyyy-mm-dd to yyyy-mm-dd, than set the correct format on the picker.
Hope this helps someone.
This works in ActiveAdmin pre 1 with the just_datetime_picker gem
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