Reputation: 27553
In ActiveAdmin dates are printed in the, supposedly American, format %B %d, %Y %H:%M
. E.g. March 19, 2013 13:25
However, my "default" frontend prints this using the default Rails (ISO) format, 2013-03-07 14:12:31 UTC
, as seen when dropping a <%= Date.new %>
anywhere in a view.
Upvotes: 16
Views: 11075
Reputation: 4855
What is defining the format for the ActiveAdmin dates?
From the Localize Format For Dates and Times section of the configuration docs:
Active Admin sets
:long
as default localize format for dates and times.
Source: General Configuration - Localize Format For Dates and Times.
Where or how can this be changed, if possible, simply following a global Rails wide i18n setting.
From ActiveAdmin v1.0.0.pre2 you can override the default localize_format
configuration to use a different format:
ActiveAdmin.setup do |config|
config.localize_format = :short
end
Alternatively you can update the :long
format in your locales configuration as suggested by Fivell:
en:
date:
formats:
long: "%Y-%m-%d"
time:
formats:
long: "%Y-%m-%d %H:%M:%S"
Upvotes: 10
Reputation: 11929
please, ensure you have next lines in your config/locales/en.yml
en:
date:
formats:
long: "%Y-%m-%d"
time:
formats:
long: "%Y-%m-%d %H:%M:%S"
Also if you want to change Filter default date formats Try this Active Admin date filter date format customisation
Upvotes: 34