Format date in ActiveAdmin form

I got a list of trips which I display in ActiveAdmin, the index uses a formats.fr.yml and the date is displayed with the right format.
However, when I modify a trip, in the form, ActiveAdmin doesn’t use formats.fr.yml anymore.
Here is the line in the form :

f.input :start_date, as: :date_time_picker

I tried something like this :

f.input :start_date, as: :date_time_picker, :value => :start_date.strftime('%d-%m-%Y %I:%M')

But it doesn’t work.
By the way, when I change the date with the datepicker, it changes the date to the right format (but because of some js).

Thanks for your help.


Source: ruby

Leave a Reply